[R] [R} Expected Percent Correctly Predicted (ePCP)

From: Joseph Magagnoli <jcm331_at_gmail.com>
Date: Sun, 23 Nov 2008 18:19:19 -0600

Hi all,
I ran a logit model and I would like to calculate the ePCP. The problem is that I have missing data and I cant calculate the ePCP. Does anyone know how to calculate this with missing data? here are the codes I used-but I guess it only works when the data is complete

###Model 2
#1 estimate the model

logit2<-zelig(inter~conv + asym + lnbdeadbest + strength + numgrps + durest + cap + border + coldwar + ethnic + govt + mixedaim+ lmtnest + polity2 + lamerica + ssafrica + asia + nafrme, model="logit",data=data)

#2 record the coefficients and variance-covarnaicne matrix
coeff <- logit2$coefficients
covar <- vcov(logit2)

#3 simulate the coefficients vector and variance matrix
simcoef <- rmvnorm(n=1000, mean=coeff, sigma=covar)

#4 compute the predicted probabilities

sphat <- invlogit(cbind(1, conv, asym, lnbdeadbest, strength, numgrps, durest, cap, border, coldwar, ethnic, govt, mixedaim, lmtnest, polity2, lamerica, ssafrica, asia, nafrme ) %*% t(simcoef))

#5 compute ePCP

n <- nrow(data)
sump <- matrix(NA, 1000, n)
sump[inter==1] <- sphat[inter==1]
sump[inter==0] <- 1-sphat[inter==0]
ePCP2 <- (1/1000) * colSums(sump)
quantile(ePCP2, c(0.025, 0.975))

        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 24 Nov 2008 - 01:19:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 24 Nov 2008 - 03:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive