0

I'm trying to get the Confusion Matrix for a probit model, nonetheless, i get the next error! Actually i know that length(Y) is bigger than length(pprobit) but i don't know how to fix this.

**Probit model coefficients**
probit<- glm(Y ~ X, family=binomial (link="probit"))

**Probit model predicted probabilities**
pprobit<- predict(probit, type="response")

**Percent correctly predicted values**
table(true = Y, pred = round(fitted(probit)))

**Error in table(true = Y, pred = round(fitted(probit))) : 
  all arguments must have the same length**


What i tried in order to fix the error:

1. na.omit(y)

2. 
tab=table(true = Y[complete.cases(X)],  pred = round( fitted(probit ))
M--
  • 25,431
  • 8
  • 61
  • 93
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. What was the problem with your fix? – MrFlick Apr 13 '20 at 18:17
  • I was trying with dput() function, but my data base is really large! Do you have some idea how could i do a reproducible example? – Maria Camila Urrego Apr 13 '20 at 20:43
  • `dput (head (data, 100))` – Edward Apr 14 '20 at 01:06
  • Your second attempt should work, but you've omitted a final bracket `)` – Edward Apr 14 '20 at 01:17

0 Answers0