RE: [R] factors in multinom function (nnet)

From: <Bill.Venables_at_csiro.au>
Date: Wed 13 Apr 2005 - 09:57:56 EST


Alexandre,

I have a couple of remarks to make, not all of which you might find immediately helpful, I regret to say.

Bill Venables.

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Alexandre Brito Sent: Wednesday, 13 April 2005 8:20 AM
To: r-help@stat.math.ethz.ch
Subject: [R] factors in multinom function (nnet)

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

Alexandre



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

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 10:05:41 2005

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