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)
hist(ePCP2)
quantile(ePCP2, c(0.025, 0.975))

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to