[R-sig-ME] Reducing two mixed models into one

Timothy MacKenzie |@w|@wt @end|ng |rom gm@||@com
Tue Jun 13 18:36:06 CEST 2023


Dear Thierry,

Thank you so much for your highly informative answer. If I may, I
wanted to ask a follow-up question.

Previously, from the two separate models, I used to compute a
correlation (0.849635) between the random slopes of subjects in
'Condition==unrelated' for Odd vs. Even items (shown below).

**Question: Could we obtain the latent equivalent of the above
correlation (which may not be numerically the same as 0.849635) from
`attr(VarCorr(First_Parametrization_Model)$Subject, "correlation")`?

Thank you so much again,
Tim M

ranef_model_2_even = data.frame(ranef(model_2)$Subject)
ranef_model_2_even$Subject <- row.names(ranef_model_2_even)
ranef_model_3_odd = data.frame(ranef(model_3)$Subject)
ranef_model_3_odd$Subject <- row.names(ranef_model_3_odd)

Subject = merge(ranef_model_2_even, ranef_model_3_odd, by = "Subject",
suffixes = c("_even", "_odd"))
cor(Subject$Conditionunrelated_even, Subject $Conditionunrelated_odd)
#  [1] 0.849635





On Mon, Jun 12, 2023 at 1:36 AM Thierry Onkelinx
<thierry.onkelinx using inbo.be> wrote:
>
> Dear Timothy,
>
> Add the interaction with item_num to every parameter and you should have the same parameterization for both models in a single model.
>
> # gives similar parameters as both models
> I(-1/RT) ~ item_num + item_num:Condition + (item_num + item_num:Condition|Subject) + (item_num + item_num:Condition|Item)
> # same model fit, different parametrization
> I(-1/RT) ~ item_num*Condition + (item_num*Condition|Subject) + (item_num*Condition|Item)
>
> Best regards,
>
> ir. Thierry Onkelinx
> Statisticus / Statistician
>
> Vlaamse Overheid / Government of Flanders
> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST
> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
> thierry.onkelinx using inbo.be
> Havenlaan 88 bus 73, 1000 Brussel
> www.inbo.be
>
> ///////////////////////////////////////////////////////////////////////////////////////////
> 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
> ///////////////////////////////////////////////////////////////////////////////////////////
>
>
>
>
> Op za 10 jun 2023 om 19:06 schreef Timothy MacKenzie <fswfswt using gmail.com>:
>>
>> Hello All,
>>
>> I'm hoping to clarify my prior post to elicit an informative response
>> from the experts on the list.
>>
>> Currently, I'm running two models each using a subset of my data (below).
>>
>> <Question>: Instead of running two separate models, is it possible to
>> create one model that captures both these separate models?
>>
>> Thank you,
>> Tim M
>> ################
>> d = read.csv("https://raw.githubusercontent.com/fpqq/w/main/d3.csv")
>> library(optimx)
>> library(blme)
>>
>> # Subset 1:
>> model_2 = blmer(I(-1/RT) ~ Condition + (Condition|Subject) + (Condition|Item),
>> data = d, control=lmerControl(optimizer="optimx",optCtrl=list(method="nlminb")),
>>            subset = item_num == "Even")
>>
>> # Subset 2:
>> model_3 = blmer(I(-1/RT) ~ Condition + (Condition|Subject) + (Condition|Item),
>> data = d, control=lmerControl(optimizer="optimx",optCtrl=list(method="nlminb")),
>>              subset = item_num == "Odd")
>>
>> _______________________________________________
>> R-sig-mixed-models using 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