[R] factors in multinom function (nnet)

From: Alexandre Brito <alexbri_at_netcabo.pt>
Date: Wed 13 Apr 2005 - 08:20:12 EST

Dear All:  

I am interested in multinomial logit models (function multinon, library nnet) but I'm having troubles in choose whether to define the predictors as factors or not.  

I had posted earlier this example (thanks for the reply ronggui):  

worms<- data.frame(year= rep(2000:2004, c(3,3,3,3,3)),age=rep(1:3,5), mud=c(2,5,0,8,7,7,5,9,14,12,8,7,5,13,11),sand=c(4,7,13,4,14,13,20,17,15,23,20,9,35,27,18), rocks=c(2,6,7,9,3,2,2,10,5,19,13,17,11,20,29))  

k<- as.matrix(worms[,3:5])  

(mud, sand and rocks are factors; age and year are predictors)  

Now there are several possibilities:  

m1<- multinom(k~year+age,data=worms)

m2<- multinom(k~factor(year)+age,data=worms)

m3<- multinom(k~year+factor(age),data=worms)

m4<- multinom(k~factor(year)+factor(age),data=worms)

m5<- multinom(k~year:age,data=worms)

m6<- multinom(k~year*age,data=worms)

m7<- multinom(k~factor(year):age,data=worms)

m8<- multinom(k~year:factor(age),data=worms)  

and so on.    

I am far from an expert on this, and I would like to learn more about the utilization of multinom function in R and the kind of doubts I described above. So I hope that someone can recommend me some references in this matter (internet, books...) if any is available.  

Thanks in advance, best wishes  


        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 13 08:27:29 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:07 EST