[R] multinom function
alexbri
alexbri at netcabo.pt
Thu Mar 31 13:44:51 CEST 2005
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
More information about the R-help
mailing list