[R-sig-ME] Random slopes for 2 variables and random intercept for 1 variable
Shadiya Al Hashmi
saah500 at york.ac.uk
Wed Apr 27 17:46:29 CEST 2016
Many thanks indeed Thierry!
I tried both options, one with no variation in the intercept and another
with correlated intercept as in maxmodal1 and maxmodal1.1.
When I compared them using anova, the one with no variation in the
intercept was found to better fit the data.
> anova(maxmodal1, maxmodal1.1)
Data: msba
Models:
maxmodal1: match ~ Listgp + length + context + gender + age + freq. + (0 +
maxmodal1: Listgp | stimulus) + (0 + length | listener) + (0 + context
|
maxmodal1: listener)
maxmodal1.1: match ~ Listgp + length + context + gender + age + freq. +
(length +
maxmodal1.1: context | listener) + (Listgp | stimulus)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
maxmodal1 29 1169.5 1317.6 -555.73 1111.5
maxmodal1.1 31 1171.8 1330.2 -554.90 1109.8 1.6631 2 0.4354
My task now is to decide whether I need the one with or without variation
in the intercept!
Thanks again Thierry.
Best wishes,
Shad
On 27 April 2016 at 14:34, Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:
> Adding (Listgp|stimulus) + (length + context|listener) to the formula
> would add these slopes and their correlations.
>
> Other options are possible. e.g. (0 + Listgp|stimulus) + (0 +
> length|listener) + (0 + context |listener). Please have a look at
> http://glmm.wikidot.com/faq and look for "Model specification etc." (0 +
> x|group) is explained on that webpage.
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> 2016-04-27 11:32 GMT+02:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
>
>> Dear Thierry,
>>
>> Apologies if my question wasn't clear.
>>
>> I need to add a slope for Listgp per stimulus, a slope for length per
>> listener and a slope for context per listener.
>>
>> Listgp per listener is intercept only, length and context per stimulus
>> per listener are both intercept only.
>>
>> Hope this clarifies things.
>>
>> Best wishes,
>>
>> Shad
>>
>> Sent from my iPhone
>>
>> On Apr 27, 2016, at 12:21 PM, Thierry Onkelinx <thierry.onkelinx at inbo.be>
>> wrote:
>>
>> Dear Shad,
>>
>> Your question isn't very clear. You'll need to tell use which random
>> slopes you want to add to the model.
>>
>> ir. Thierry Onkelinx
>> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
>> and Forest
>> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
>> Kliniekstraat 25
>> 1070 Anderlecht
>> Belgium
>>
>> To call in the statistician after the experiment is done may be no more
>> than asking him to perform a post-mortem examination: he may be able to say
>> what the experiment died of. ~ Sir Ronald Aylmer Fisher
>> The plural of anecdote is not data. ~ Roger Brinner
>> The combination of some data and an aching desire for an answer does not
>> ensure that a reasonable answer can be extracted from a given body of data.
>> ~ John Tukey
>>
>> 2016-04-27 11:17 GMT+02:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
>>
>>> Thanks Thierry but I need the random effects in the model since I am
>>> working within a generalized mixed effects model. That's why I used glmer.
>>>
>>> The reason why I didn't include the random effects in the model is that
>>> I wasn't sure of how to translate the slopes and intercepts of the
>>> variables.
>>>
>>> Two ways I could think of, however, are as follows.
>>>
>>> maxmodal<- glmer(match ~ Listgp + length + context + gender + age +
>>> freq. + (0-Listgp|listener), (1+length|listener)+(1+context|listener),
>>> (1+Listgp|stimulus), (0-length|stimulus), (0-context|stimulus), data =
>>> msba, family = "binomial", control = glmerControl(optimizer =
>>> "bobyqa"), nAGQ =1)
>>>
>>> maxmodal<- glmer(match ~ Listgp + length + context + gender + age +
>>> freq. + (1-Listgp|listener), (1+length|listener)+(1+context|listener),
>>> (1+Listgp|stimulus), (1-length|stimulus), (1-context|stimulus), data =
>>> msba, family = "binomial", control = glmerControl(optimizer =
>>> "bobyqa"), nAGQ =1)
>>>
>>>
>>> However, I am not sure either is the right way to go about it.
>>>
>>> Best wishes,
>>>
>>> Shad
>>>
>>> On 27 April 2016 at 11:45, Thierry Onkelinx <thierry.onkelinx at inbo.be>
>>> wrote:
>>>
>>>> Dear Shadiya,
>>>>
>>>> glmer() requires at least one random effect. You can use glm() to fit
>>>> the model without random effects.
>>>>
>>>> Best regards,
>>>>
>>>> ir. Thierry Onkelinx
>>>> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
>>>> and Forest
>>>> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
>>>> Kliniekstraat 25
>>>> 1070 Anderlecht
>>>> Belgium
>>>>
>>>> To call in the statistician after the experiment is done may be no more
>>>> than asking him to perform a post-mortem examination: he may be able to say
>>>> what the experiment died of. ~ Sir Ronald Aylmer Fisher
>>>> The plural of anecdote is not data. ~ Roger Brinner
>>>> The combination of some data and an aching desire for an answer does
>>>> not ensure that a reasonable answer can be extracted from a given body of
>>>> data. ~ John Tukey
>>>>
>>>> 2016-04-27 10:38 GMT+02:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
>>>>
>>>>> Good morning,
>>>>>
>>>>>
>>>>> I have a data design which includes 3 factors of interest/*experimental
>>>>> manipulations* (using Barr et. al’s (2013) terminology); namely
>>>>> *Listgp*
>>>>> (listener group: T[monolinguals], TA [bilinguals] and TQ [Turkish
>>>>> speakers
>>>>> who know Arabic through reading Quran]), *length* (long and short
>>>>> vowels)
>>>>> and *context (emphatics, pharyngeals, plain and q)*.
>>>>>
>>>>>
>>>>>
>>>>> *Listgp* is a *between-listener* (subject) and *within-stimulus* (item)
>>>>> variable [(1|listener), (1+Listgp|stimulus)] while both *length* and
>>>>> *context* are *within-listener* and *between-stimulus* variables
>>>>> [(1+length|listener), (1|stimulus) and (1+context|listener),
>>>>> (1|stimulus)].
>>>>>
>>>>>
>>>>>
>>>>> My question is, how can I code this in the following maximal model
>>>>> lacking
>>>>> the random effects (for the time being?
>>>>>
>>>>>
>>>>>
>>>>> maxmodal<- glmer(match ~ Listgp + length + context + gender + age +
>>>>> freq.,
>>>>> data = msba, family = "binomial", control = glmerControl(optimizer =
>>>>> "bobyqa"), nAGQ =1)
>>>>>
>>>>>
>>>>>
>>>>> Here is more information on the variables involved.
>>>>>
>>>>> *DV/Y (response):* match
>>>>>
>>>>> *Random effects:* listener and stimulus
>>>>>
>>>>> *Fixed effects/predictors:* a) *By-listener predictors*+ b)
>>>>> *by-stimulus
>>>>> predictors: *
>>>>>
>>>>> *a) By-listener predictors:* (*3*)
>>>>>
>>>>> *1. Factors: (2)*
>>>>>
>>>>> -*Listgp* (listener group): effect of interest (T: monolingual Turkish
>>>>> speakers, TA: bilingual Turkish speakers and TQ: Turkish speakers who
>>>>> know
>>>>> Arabic through reading Quran).)
>>>>>
>>>>> -*gender* (female and male)
>>>>>
>>>>>
>>>>>
>>>>> *2. Continuous predictors (1)*
>>>>>
>>>>> -*age *(age of listeners at the time of experiment)
>>>>>
>>>>>
>>>>>
>>>>> *b) By-stimulus predictors: (3)*
>>>>>
>>>>> *1. Factors: (2)_*
>>>>>
>>>>> -* context *(stimulus context: emphatic, pharyngeal, plain and q)
>>>>>
>>>>> -*length *(stimulus length: long and short)
>>>>>
>>>>> *2. Continuous predictors: (1)*
>>>>>
>>>>> -*freq*. (stimulus frequency as per arabiCorpus)
>>>>>
>>>>> Number of obs: 1224, groups: listener, 51; stimulus, 24
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Appreciating your kind input.
>>>>>
>>>>> --
>>>>> Shad
>>>>>
>>>>> [[alternative HTML version deleted]]
>>>>>
>>>>> _______________________________________________
>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>
--
Shadiya al-Hashmi
PhD candidate
Department of Language & Linguistic Science
University of York, Heslington, York YO10 5DD
email: saah500 at york.ac.uk
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list