here's some code as an example....  hope it helps!

mod<-polr(vote~age+demsat+eusup+lrself+male+retnat+union+urban, data=dat)
summary(mod)

 
mod<-polr(vote~age+demsat+eusup+lrself+male+retnat+union+urban, data=dat)
levs<-levels(dat$vote)
tmpdat<-list()
for(i in 1:(nlevels(dat$vote)-1)){
tmpdat[[i]] <- dat
tmpdat[[i]]$z <- as.numeric(as.numeric(tmpdat[[1]]$vote) <= levs[i])
}
form<-as.formula("z~age+demsat+eusup+lrself+male+retnat+union+urban")
mods<-lapply(tmpdat, function(x)glm(form, data=x, family=binomial))
probs<-sapply(mods, predict, type="response")
p.logits<-cbind(probs[,2], t(apply(probs, 1, diff)), 1-probs[,ncol(probs)])
p.ologit<-predict(mod, type='probs')
n<-nrow(p.logits)
bin.ll <- p.logits[cbind(1:n, dat$vote)]
ologit.ll <- p.ologit[cbind(1:n, dat$vote)]
binom.test(sum(bin.ll > ologit.ll), n)
 

dat$vote.fac<-factor(dat$vote, levels=1:6)
mod<-polr(dat$vote.fac~age+demsat+eusup+lrself+male+retnat+union+urban, 
data=dat)
 
source("http://www.quantoid.net/cat_pre.R ")
catpre(mod)
 
install.packages("rms")
library(rms)
olprobs<-predict(mod, type='probs')
pred.cat<-apply(olprobs, 1, which.max)
table(pred.cat, dat$vote)
 
round(prop.table(table(pred.cat, dat$vote), 2), 3)
On Mar 11, 2013, at 5:02 PM, Heather Kettrey wrote:

> Hi,
> 
> I am running an analysis with an ordinal outcome and I need to run a test
> of the parallel regression assumption to determine if ordinal logistic
> regression is appropriate. I cannot find a function to conduct such a test.
>> From searching various message boards I have seen a few useRs ask this same
> question without a definitive answer - and I came across a thread that
> indicated there is no such function available in any R packages. I hope
> this is incorrect.
> 
> Does anyone know how to test the parallel regression assumption in R?
> 
> Thanks for your help!
> 
> 
> -- 
> Heather Hensman Kettrey
> PhD Candidate
> Department of Sociology
> Vanderbilt University
> 
>       [[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.


        [[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