[R-sig-ME] R-sig-mixed-models Digest, Vol 66, Issue 11

Malcolm Fairbrother m.fairbrother at bristol.ac.uk
Thu Jun 7 13:49:17 CEST 2012


Dear Teresa,

Would the "ordinal" package have what you're looking for?

http://cran.r-project.org/web/packages/ordinal/

Un saludo,
Malcolm



> Date: Thu, 07 Jun 2012 10:31:40 +0200
> From: "MORAN LOPEZ, TERESA" <tmoranlopez at mncn.csic.es>
> To: Chris Howden <chris at trickysolutions.com.au>
> Cc: "r-sig-mixed-models at r-project.org"
> 	<r-sig-mixed-models at r-project.org>
> Subject: Re: [R-sig-ME] Running multinomial models with random effects
> Message-ID: <20120607103140.16232bmjomxwcx64 at webmail.csic.es>
> Content-Type: text/plain
> 
> Thanks a lot Chris,
> I will try that one and see what happens. However, if someone knows how to run multinomials with random effects I will be very greatful!
> 
> Quoting Chris Howden:
> 
>> I'm not neccsarily advocating this. But another way is to use 3
>> logistic models with random effects.   One for wether they choose big
>> acorn, one for small, one for both. Then compare the parameters of all
>> 3 to see if there are any differences.
>> 
>> Chris Howden
>> Founding Partner
>> Tricky Solutions
>> Tricky Solutions 4 Tricky Problems
>> Evidence Based Strategic Development, IP Commercialisation and
>> Innovation, Data Analysis, Modelling and Training
>> 
>> (mobile) 0410 689 945
>> (fax / office)
>> chris at trickysolutions.com.au
>> 
>> Disclaimer: The information in this email and any attachments to it are
>> confidential and may contain legally privileged information. If you are not
>> the named or intended recipient, please delete this communication and
>> contact us immediately. Please note you are not authorised to copy,
>> use or disclose this communication or any attachments without our
>> consent. Although this email has been checked by anti-virus software,
>> there is a risk that email messages may be corrupted or infected by
>> viruses or other
>> interferences. No responsibility is accepted for such interference. Unless
>> expressly stated, the views of the writer are not those of the
>> company. Tricky Solutions always does our best to provide accurate
>> forecasts and analyses based on the data supplied, however it is
>> possible that some important predictors were not included in the data
>> sent to us. Information provided by us should not be solely relied
>> upon when making decisions and clients should use their own judgement.
>> 
>> On 07/06/2012, at 3:00, "MORAN LOPEZ, TERESA" 
>> <tmoranlopez at mncn.csic.es> wrote:
>> 
>>> Dear all,
>>> I am a phD student working on animal behavior under different 
>>> predation risk. We have conducted an experiment in which acorn 
>>> selection by jays was evaluated in savanna vs forest-type  
>>> landscapes.  We placed 8 feeders in two different forests and 8 
>>> feeders in two different savannas.
>>> My response variable is factorial, acorn choice (big, small, both).  
>>> In my design I have spatial pseudorreplication within Areas.  I have 
>>> not found multinom function which allows fitting random effects. 
>>> However, MCMCglmm package allows incorporating them using Bayesian 
>>> Methods. I am new using Bayesian Methods so it has taken me a lot of 
>>> effort to partially understand these models implementation. However, 
>>> once I have run my model I am not sure about output interpretation 
>>> and most importantly how to convert fix effect parameters into 
>>> probabilities.
>>> 
>>> I have tried three different things: to convert my data in binomial 
>>> (ignoring  infrequent acorn choice “both”) and run mixed model lmer. 
>>> Pros: I can include random effects , Cons: I lose an infrequent but 
>>> informative level of the response.
>>> 
>>> Keep categorical responses and run multinom function without random 
>>> effects.  Pros: I can fit my response variable as categorical and 
>>> keep all levels. Cons: I am ignoring spatial autocorrelation 
>>> (however, when running binomial models acorn choice variation 
>>> between areas was much more lower than between risk levels).
>>> +
>>> Run MCMCglmm model with random effects. Pros:  I can keep both 
>>> spatial autocorrelation and all levels of the response factor. Cons: 
>>> Not sure about  model implementation and interpretation. Low sample 
>>> size.
>>> 
>>> 
>>> Which option is the most accurate?
>>> 
>>> Thanks a lot! I am really stucked with my data.
>>> 
>>> Here I post my MCMCglmm model which is the one I have more doubts
>>> 
>>> #head(choice)-dataset with choice as factor  (b=big, s=small, bt=both)
>>>  RISK       Area             CHOICE
>>> LOW        Sopie                  b
>>> LOW       Sopie                  b
>>> LOW      Sopie                   b
>>> LOW  Anchurones                  s
>>> LOW  Anchurones                  bt
>>> LOW  Anchurones                  b
>>> 
>>> I have read package tutorial and Hadfield notes (though I have not 
>>> read all the chapter of Hadfield course notes). Besides I have used 
>>> information posted  Jaeger lab blog: 
>>> http://hlplab.wordpress.com/2009/05/07/multinomial-random-effects-models-in-r/
>>> 
>>> I am not very sure about random effects priors but I believe the 
>>> rest of them are ok.
>>> k <- length(levels(choice$CHOICE))
>>> I<- diag(k-1)
>>> J <- matrix(rep(1, (k-1)^2), c(k-1, k-1))
>>> #Constraints to variance-covariance matrix
>>> 
>>> prior = list(R = list(fix=1, V =(1/k) * (I + J), n=k), G = list(G1 = 
>>> list(V =diag(2), n=2)))
>>> 
>>> #R priors, Hadfield manual suggests that structure. Are they right?  
>>> NOT SURE ABOUT RANDOM PRIORS.
>>> 
>>> M<- MCMCglmm(CHOICE~ -1+ trait + RISK,
>>>             random = ~ us(trait):Area,
>>>             rcov = ~ us(trait):units,
>>>             prior = prior,
>>>             family = "categorical",
>>>             data = choice)
>>> 
>>> #-1+trait following Hadfield suggestions in order to estimate 
>>> interception if every outcome.
>>> us(trait):-----  since we are not sure of independence assumptions. 
>>> Is model function allright?
>>> 
>>> My model runs but I find it very difficult to interpret my summary
>>> 
>>> summary(M)
>>> 
>>> Iterations = 3001:12991
>>> Thinning interval  = 10
>>> Sample size  = 1000
>>> 
>>> DIC: 44.21802
>>> 
>>> G-structure:  ~us(trait):Area
>>> 
>>>                        post.mean l-95% CI u-95% CI eff.samp
>>> CHOICE.bt:CHOICE.bt.Area    14.622   0.1881    64.46    7.278
>>> CHOICE.s:CHOICE.bt.Area      3.274 -11.1431    19.29  116.593
>>> CHOICE.bt:CHOICE.s.Area      3.274 -11.1431    19.29  116.593
>>> CHOICE.s:CHOICE.s.Area       5.071   0.1416    15.82  127.395
>>> 
>>> R-structure:  ~us(trait):units
>>> 
>>>                         post.mean l-95% CI u-95% CI eff.samp
>>> CHOICE.bt:CHOICE.bt.units    0.6667   0.6667   0.6667        0
>>> CHOICE.s:CHOICE.bt.units     0.3333   0.3333   0.3333        0
>>> CHOICE.bt:CHOICE.s.units     0.3333   0.3333   0.3333        0
>>> CHOICE.s:CHOICE.s.units      0.6667   0.6667   0.6667        0
>>> 
>>> Location effects: CHOICE ~ -1 + trait + RISK
>>> 
>>>              post.mean l-95% CI u-95% CI eff.samp pMCMC
>>> traitCHOICE.bt   -4.5042 -11.8926   0.3824    15.18 0.052 .
>>> traitCHOICE.s    -2.0187  -6.3370   1.3569    84.55 0.200
>>> RISKRAÑA          1.9095  -2.3541   8.2421    56.13 0.336
>>> ---
>>> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>>> 
>>> posterior.mode(M$Sol)
>>> 
>>> traitCHOICE.bt   traitCHOICE.s       RISKRAÑA
>>>    -2.594132      -1.836527             1.554387
>>> 
>>> #Since there is not any intercept I can´t apply plogis() in order to 
>>> get probabilities of choice in different areas.
>>> 
>>> 
>>> Sorry that I have that many  questions and thanks a lot!!!
>>> 
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list