[R] glm - prediction of a factor with several levels
blackscorpio
olivier.collignon at live.fr
Mon Jul 26 11:18:04 CEST 2010
Thanks a lot for your anwers.
To Ben Bolker : I am trying to perform an ordinal logistic regression to
predict an Y 3-class variable, having observed 3 continous predictors V1,
V2, V3.
With random data my code would be something like :
# simulate 10 observations of 3 independant N(0,1) predictors
X=rmvnorm(10,rep(0,3))
# variable to predict
Y=c(1,1,1,2,2,2,3,3,3,3)
# create data frame
A=as.data.frame(cbind(X,Y))
# turn Y into class variable
A$Y=as.factor(A$Y)
# perform logisitic regression
glm(Y~V1+V2+V3,A,family="binomial")
As only one intercept is returned, it seems indeed that a 2-class model has
been performed instead, as said by zachmor.
Although I solved my problem by using polr instead of glm, I'd like to
understand what glm does in such a case since it gave me better
well-classification rates with the predict function.
Thanks a lot again !
--
View this message in context: http://r.789695.n4.nabble.com/glm-prediction-of-a-factor-with-several-levels-tp2300793p2302078.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list