Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • in reply to: specifying correct lmer_alt models #244
    statmerkur
    Participant

    EDIT (I don’t know how I can edit or delete my question?!): I realized that this is a broader question that is not directly related to lmer_alt but more so to lmer and mixed models in general. So I decided to post it on CrossValidated.

    in reply to: Why contr.sum for random effects grouping factors? #237
    statmerkur
    Participant

    OK, so mixed converts treatment coded random effects grouping factors to sum coded factors (via contr.sum) just by convention?

    in reply to: Why contr.sum for random effects grouping factors? #235
    statmerkur
    Participant

    Thanks, that cleared things up for me.
    What I still don’t understand is in which case the coding for the random-effects grouping factors does make a difference. Can you please give an (R code) example for this situation?

    in reply to: Why contr.sum for random effects grouping factors? #232
    statmerkur
    Participant

    There seems to be no difference between models with different coding schemes for the random-effects grouping factors, i.e. m1 = m2and m3a = m4a. Hence I don’t understand why afex sets contr.sum for the random-effects grouping factors (Worker in the example below).

    Besides that, AFAIU, m3b and m4b are models where random slopes are coded differently (treatment coding vs sum coding) and they seem to estimate the same random effects which in turn are the same as m5s (which also suppresses the fixed intercept) estimates for the random effects.

    Why is that?

    library(afex)
    data("Machines", package = "MEMSS")
    
    m1<- mixed(score ~ Machine + (Machine|Worker), Machines)
    contrasts(Machines$Machine) <- contr.sum(length(levels(Machines$Machine)))
    m2 <- mixed(score ~ Machine + (Machine|Worker), Machines, check_contrasts = F)
    m1$full_model # Machine sum coded + Worker sum coded
    m2$full_model # Machine sum coded + Worker treatment coded
    
    contrasts(Machines$Machine) <- contr.treatment(length(levels(Machines$Machine)))
    m3a <- mixed(score ~ Machine + (Machine|Worker), Machines, check_contrasts = F)
    m3b <- mixed(score ~ Machine + (0 + Machine|Worker), Machines, check_contrasts = F)
    contrasts(Machines$Worker) <- contr.sum(length(levels(Machines$Worker)))
    m4a <- mixed(score ~ Machine + (Machine|Worker), Machines, check_contrasts = F)
    m4b <- mixed(score ~ Machine + (0 + Machine|Worker), Machines)
    m5 <- mixed(score ~ 0 + Machine + (0 + Machine|Worker), Machines, check_contrasts = F)
    m3a$full_model # Machine treatment coded + Worker treatment coded
    m4a$full_model # Machine treatment coded + Worker sum coded
    
    m3b$full_model # Machine treatment coded + Worker treatment coded + random intercept suppressed 
    m4b$full_model # Machine sum coded + Worker sum coded + random intercept suppressed 
    m5$full_model  #  Machine treatment coded + Worker sum coded + fixed and random intercept suppressed 
    in reply to: Why contr.sum for random effects grouping factors? #227
    statmerkur
    Participant

    I was just curious whether there was a specific reason for that. So, would you agree that using orthogonal contrasts for categorical covariates and, say, treatment coding for random effects grouping factors is equivalent to using orthogonal contrasts for both categorical covariates and random effects grouping factors?

    in reply to: warning: missing cells for some factors #221
    statmerkur
    Participant

    I am indeed interested in the individual parameters as I have specific hypotheses for different a priori contrasts. Maybe using contr.sum() was not the best example to illustrate this. But thanks for reminding me on the fact that afex is designed to provide tests of (main-)effects – it now became clear to me that using your package for this purpose seems to be inappropriate. However, when I use set_data_arg = FALSE I still get the same results.

    in reply to: Estimated marginal means don't match SPSS #172
    statmerkur
    Participant

    This makes perfect sense and I can think of both situations where using lsmeans would be useful and where it wouldn’t. So in case of unequal cell sizes, should the dependent t-tests still match the SPSSs EMMEANS or how can one do an equivalent analysis in R then?

    in reply to: warning epsilon > 1 for HF correction #158
    statmerkur
    Participant

    Yes, it only appears if I use the HF. I didn’t know that epsilon can be above 1 – thanks for the hint.

    in reply to: Random effect equivalence #143
    statmerkur
    Participant

    Thank you again for explaining the issue in a very comprehensible way!

    in reply to: Random effect equivalence #140
    statmerkur
    Participant

    Thanks for this detailed answer!
    You state that the fits are the same as long as one uses REML = FALSE. Why would the results be different if one used REML = TRUE?

    in reply to: expand_re with missing values #130
    statmerkur
    Participant

    Yes, that made it clear! Thanks.

Viewing 11 posts - 1 through 11 (of 11 total)