Alexandre,
I have a couple of remarks to make, not all of which you might find
immediately helpful, I regret to say.
* The choice between using predictors linearly or in factor versions is
a modelling choice that is in no way specific to multinom. It is a
general aspect of modelling that has to be faced in a whole variety of
situations. Indeed the full spectrum of choices is much wider than
this: linear, polynomials, splines, different sorts of splines, harmonic
terms, factors, ... In fact the idea behind gam's was really to allow
some of this extensive field of choices to be model driven, but I
digress. Point 1: you need to learn about modelling first and then
apply it to multinom.
* It is curious to me that someone could be interested in multinomial
models per se. Usually people have a context where multinomial models
might be one approach to describing the situation in a statistically
useful way. Another could be something like classification trees. The
context is really what decides what modelling choices of this kind might
be sensible.
* There is an obvious suggestion for one reference, a certain notorious
blue and yellow book for which multinom is part of the support software.
I believe they discuss some of the alternatives as well, like
classification trees, and some of the principles of modelling, but it's
been a while since I read it...
* Frank Harrell recently issued an excellent article on this list on
brain surgery in a hurry to which you may usefully refer. I believe it
was on April 1.
Bill Venables.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Alexandre Brito
Sent: Wednesday, 13 April 2005 8:20 AM
To: r-help at 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 at 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