[R] multinom function

From: alexbri <alexbri_at_netcabo.pt>
Date: Thu 31 Mar 2005 - 21:44:51 EST


Dear all:  

I am trying to fit a multinomial log linear model to the following data:  

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

mud, sand and rocks are the 3 factors while age and year are predictors.

Can I fit a model with the multinom function (nnet library) to the data in this form?  

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

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

Is this correct, or is there another way?  

Thanks for your help, best wishes  

Alex



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 Thu Mar 31 22:05:32 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:57 EST