[R] polr, lrm - ordinal data
Chris Mcowen
chrismcowen at gmail.com
Thu Sep 30 16:36:07 CEST 2010
Dear List,
I have developed a model and am looking to predict a response for 1-6 ( it is ordered i.e the difference between level 1 and 2 is the same as between level 2 and 3 etc.
I have used the predict function for a polr model (below) and a lrm model, and both give similar results, however for some reason the outcome are all 1 or 6 i.e no level 2,3,4,5.
This is not correct, i am unsure if it is because my model is not good enough to predict to this accuracy or if it is something i am doing wrong?
Thanks
Chris
> test <- polr(extinction ~ FR*HAB+WO+ALT+BIO+REG,method="logistic")
> > test
> Call:
> polr(formula = extinction ~ FR * HAB + WO + ALT + BIO + REG,
> method = "logistic")
>
> Coefficients:
> FRNon_fleshy HABSemi-aquatic HABTerrestrial WOWoody ALTHigh
> 0.09758543 -0.05988101 -0.29744997 0.32746840 -0.39191606
> ALTLow ALTMid BIOBoreal BIOMediterranean BIOSubtropical/Tropical
> -0.56523156 -0.18979562 -0.22743656 -0.31344233 1.77031824
> BIOTemperate REGTwo_plus FRNon_fleshy:HABSemi-aquatic FRNon_fleshy:HABTerrestrial
> 1.45071627 -0.67654880 -2.06919408 -0.31706541
>
> Intercepts:
> 1|2 2|3 3|4 4|5 5|6
> 0.4874828 0.8340901 1.3994091 1.8091463 2.1295630
>
> Residual Deviance: 2471.053
> AIC: 2509.053
> > predict(test)
> [1] 1 1 1 1 1 1 1 1 1 1 6 1 6 1 1 6 1 1 1 6 1 1 1 6 1 1 1 1 6 1 6 6 1 1 6 1 1 1 1 6 1 1 1 1 6 6 1 1 6 1 1 1 1 1 6 1 1 1 1 6 1 1 6 1 6 1 6 1 1 1 1 1 1 1
> [75] 1 1 1 1 1 1 1 6 6 1 1 1 6 6 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 6 6 1 1 1 1 1 1 6 1 1 1 1 1 6 1 1 1 1 1 6 6 1 6 1 1 1 1 1 1 6 1 1 1 1 1 6 1 1 1 1 6
> [149] 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 6 1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