Hi,
I'd like to do a multinomial glm with nested and random Effects

The "multinom" function from (nnet) give me this:

> multinom(mc$c ~ (1|mc$date)+mc$lma + mc$poid+(mc$pop) +mc$male %in% 
> mc$pop,family="multinomial" )                   
# weights:  60 (44 variable)                                                    
                                        
initial  value 6801.484618                                                      
                                        
iter  10 value 5704.912781                                                      
                                        
iter  20 value 5373.764816                                                      
                                        
iter  30 value 4977.685313                                                      
                                        
iter  40 value 4746.075251                                                      
                                        
iter  50 value 4740.904959                                                      
                                        
final  value 4740.900034                                                        
                                        
converged                                                                       
                                        
Call:                                                                           
                                        
multinom(formula = mc$c ~ (1 | mc$date) + mc$lma + mc$poid +                    
                                        
    mc$pop + mc$male %in% mc$pop, family = "multinomial")                       
                                    

Coefficients:
  (Intercept) 1 | mc$dateTRUE     mc$lma    mc$poid    mc$pop2     mc$pop3
2  -3.3725062      -3.3725062  1.0578694 -0.2416550 -0.1112114  1.96731873
3   2.2583341       2.2583341 -0.1744330 -0.2552745 -0.5112047 -0.05992067
4   0.4713678       0.4713678  0.3032407 -0.3910529 -0.3587365 -0.31611663
5   0.1176258       0.1176258  0.4085705 -0.3465320 -0.4342574 -0.24052282
     mc$pop4 mc$pop1:mc$male mc$pop2:mc$male mc$pop3:mc$male mc$pop4:mc$male
2 -0.6584972      0.03764097     0.042722762     -0.04506099      0.03963405
3 -0.8932160     -0.03943989    -0.005425975     -0.03670574     -0.01614433
4 -0.6258679     -0.02901482    -0.007115797     -0.01195997     -0.00537634
5 -1.2768885     -0.02291026    -0.005762747     -0.02240182      0.01579168

Residual Deviance: 9481.8 
AIC: 9561.8               

So, multinom, seems me work with nested and random effect....
Notice that a "TRUE" is added behind the random effect

> multinom(mc$c ~ mc$mom %in% (1|mc$date) +(1|mc$date)+mc$lma + mc$poid+mc$pop 
> +mc$male %in% mc$pop,family="multinomial" )
# weights:  70 (52 variable)                                                    
                                              
initial  value 6801.484618
iter  10 value 5208.112867
iter  20 value 5084.345631
iter  30 value 4655.378383
iter  40 value 4521.895062
iter  50 value 4518.961455
final  value 4518.961019
converged
Call:
multinom(formula = mc$c ~ mc$mom %in% (1 | mc$date) + (1 | mc$date) +
    mc$lma + mc$poid + (mc$pop) + mc$male %in% (mc$pop), family = "multinomial")

Coefficients:
  (Intercept) 1 | mc$dateTRUE     mc$lma    mc$poid    mc$pop2     mc$pop3
2 -3.54938862     -3.54938862  1.0472658 -0.2389110 -0.1126589  1.97228680
3  1.98030198      1.98030198 -0.1879820 -0.2524073 -0.5180808 -0.05418255
4  1.18772479      1.18772479  0.3435563 -0.4005161 -0.3395149 -0.33326040
5  0.09882458      0.09882458  0.4066034 -0.3458763 -0.4339492 -0.23909966
     mc$pop4 mc$mom:1 | mc$dateFALSE mc$mom:1 | mc$dateTRUE mc$pop1:mc$male
2 -0.6607706                       0             0.19949190      0.03740662
3 -0.8997561                       0             0.30402706     -0.03987009
4 -0.6022370                       0            -0.98117482     -0.02774351
5 -1.2764239                       0             0.02313478     -0.02291646
  mc$pop2:mc$male mc$pop3:mc$male mc$pop4:mc$male
2     0.042692605    -0.045517538     0.039313888
3    -0.005367900    -0.037430186    -0.016624565
4    -0.007190628    -0.009714267    -0.004076609
5    -0.005761103    -0.022468428     0.015746601

Residual Deviance: 9037.922
AIC: 9125.922

Here, the "TRUE" is added at the same place, and "FALSE" is added for the 
interaction with the random factor, coefficients are 0

multinom(formula = mc$c ~(1 | mc$mom %in%  mc$date) + (1 | mc$date) +   mc$lma 
+ mc$poid + (mc$pop) + mc$male %in% (mc$pop), family = "multinomial")

work well, but is it true ?


hugo mathé hubertEmail : hug...@hotmail.fr

approximatively, my experimental design is :
some individuals (lizard) have a behaviour (a dependent unordered categorical 
variable).
lizards come from several populations, for each lizard, behaviour is registered 
at morning , at noon, at evening, during several days.

So, individuals are nested in populations and moments of the day is nested in 
the day. (isn't it ??)

I'd
like to identifies some type of individual so, (among other things) I need to 
the interaction between individuals and moment of the day
which are tow nested variable...

it's wrong to take the ( individuals : moment of the day) nested in (population 
: day)
(mc$male : mc$mom ) %in% ( mc$pop : mc$date)

(note
that, I have only ONE value (behaviour) by moment of the day by day by
individual ; but days are time series so each days aren't totally
independent...)







                                          
_________________________________________________________________
Hotmail: Trusted email with MicrosoftÂ’s powerful SPAM protection.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to