Multilevel modeling in R using lme4 package (Feb 2020): Demo of Hox 2010 Chapter 2 extended example

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 43

  • @jaykay9835
    @jaykay9835 Рік тому

    Thank you so much!! You helped me significantly during my bachelor's thesis

  • @renasfpolis
    @renasfpolis 3 роки тому +1

    Thanks for the video! Much appreciated.

  • @stinesorensen5397
    @stinesorensen5397 4 роки тому

    Very useful demonstration. Thank you for sharing Mike!

  • @jamescutler428
    @jamescutler428 3 роки тому

    Great video! Very helpful details.

  • @fangjingtu5840
    @fangjingtu5840 3 роки тому +1

    Hi Mike, thanks much for the informative video! I encountered the following error with the graph_model: ""Error in factor(grid[[term]], labels = c("-1 SD", "+1 SD")):invalid 'labels'; length 2 should be 1 or 0". My y and x are both continuous variables, and the moderator is a factor. Do you have suggestions to fix this?

  • @dobariyahardik3388
    @dobariyahardik3388 3 роки тому

    thank you very much sir ,Your video is very helpful

  • @hakeemojulari7392
    @hakeemojulari7392 3 роки тому

    @Mike Crowson, How do I use lme4 for categorical data (both predictors and response variable) and the data contains datetime

  • @itofernando1379
    @itofernando1379 3 роки тому +1

    One question please, after generating some models, How we choose the best model to be written in the report? Thank you.

  • @md.masumbillah8222
    @md.masumbillah8222 2 роки тому

    Thank you for sharing this

  • @junli7200
    @junli7200 3 роки тому +2

    Hi Mike, thank you for sharing this. I am struggling with a longitudinal multilevel model with the count (slightly over dispersion with c=1.78) as the dependent variable. How can I do this in R ?

    • @wasafisafi612
      @wasafisafi612 Рік тому

      You can use the "quasipoisson" as the family or the negative binomial model

  • @dipeshsharma7869
    @dipeshsharma7869 4 роки тому

    Wonderful video..thank you for uploading !!

  • @yutingcui2485
    @yutingcui2485 2 роки тому

    Hi Mike, thank you for your video, it makes it clear to understand lem4 package. I want to know whether there is a function to calculate the proportion of variance in lem4. It is complex to manually get R2 by comparing different models.

  • @saeidnosrati3782
    @saeidnosrati3782 3 роки тому

    Would you please tell us how we can get model fit indices and standardized estimation in this video?

  • @reaperqnu
    @reaperqnu 3 роки тому

    Is the extraversion a binary variable? If so, we can interpret the intercept as the level of popularly of an introvert male, is this correct? The coefficients of the sex and extra variables are in fact the differential effect from this referencing type.

  • @tayebehsaghapour6505
    @tayebehsaghapour6505 2 роки тому

    Hi Mike, thanks so much for the very useful video on multilevel modelling. I am trying to run a multilevel nested logit model, just wondering if you are aware of any R packages that can be used for this modelling? most packages I know haven't gone beyond the multinomial logistic model; however, in nested logit, the outcome measure itself has a hierarchical structure which makes the model even more complicated. I appreciate your advice on this. Thanks

  • @julieyananzhu1134
    @julieyananzhu1134 4 роки тому +2

    Thanks for sharing! It's very informative! Just a minor suggestion, 1+(1|x) actually can be simplified as (1|x), right? I read from lme4::lmer R help file, Table2.

    • @mikecrowson2462
      @mikecrowson2462  4 роки тому +1

      Yes you are right. I presented as my way for pedagogical purposes. Cheers!

  • @konradhryniewicz7388
    @konradhryniewicz7388 3 роки тому +1

    Nice video :))) thanks!

  • @guani2155
    @guani2155 4 роки тому

    Hi Mike, I had a problem when running the the fist function str(hox2010ch2).Here is the code and the error information:
    > str(hox2010ch2)
    'data.frame': 2000 obs. of 12 variables:
    Error in nchar(x, type = "w", allowNA = TRUE) :
    invalid multibyte string, element 1
    Could you please tell me what's wrong with it?

    • @guani2155
      @guani2155 4 роки тому

      I'm running it in RStudio, it shows the error information. But I tried it in R then I can see the structure of the data

    • @daviddearlove
      @daviddearlove 3 роки тому

      @@guani2155 ditto. did you do the rest in r vs. r studio?

    • @guani2155
      @guani2155 3 роки тому

      @@daviddearlove Hi David, I was using R studio

  • @saeidnosrati3782
    @saeidnosrati3782 3 роки тому +1

    Hi Mike, thank you for sharing this fantastic video. As a Ph.D. student in the field of management, I want to run a conceptual model with multilevel regression, however, I can not. would it be possible to share us a video in which a conceptual model is being run?

  • @danielmax562
    @danielmax562 2 роки тому

    It seems confusing to me cause we have Level 1 and Level 2 variables but in the models in R they are all put together, side by side, without distinction. How does the model "know" that they belong to different levels?

    • @nafisanwari6288
      @nafisanwari6288 Рік тому

      I think the value of level 2 variables stay the same within a particular group, but varies with other groups. See the data structure posted at the beginning of the video

  • @daqingliu7082
    @daqingliu7082 4 роки тому

    Thanks for making this very useful video!
    I had a problem when using reghelper::graph_model. My model has two categorical variables (a and b) as predictors and one continuous covariate (c): m1

  • @benabdallahnadia1014
    @benabdallahnadia1014 4 роки тому

    thanks very much for this video. is-it a cross-section analysis? can we extend this model to panel data model??

    • @mikecrowson2462
      @mikecrowson2462  3 роки тому +1

      Hi there. This example assumes cross-sectional data. However, yes, you can extend this to panel data (e.g., rpsychologist.com/r-guide-longitudinal-lme-lmer). That said, I don't believe you can model more complex level 1 error structures (e.g., autoregressive) using lmer (as you can do in other programs). Cheers!

    • @benabdallahnadia1014
      @benabdallahnadia1014 3 роки тому

      @@mikecrowson2462 thank you very much...

  • @spiousas
    @spiousas 4 роки тому

    Is there a way to use the graph_model for three-way interactions?

  • @amanrastogi5184
    @amanrastogi5184 4 роки тому +3

    Sir, Can you make a video on Multivariate Multilevel Modelling (theory + practical) ? it will be very helpful of you, Thank You.

    • @mikecrowson2462
      @mikecrowson2462  4 роки тому +1

      Hi Aman, I'll put this on my "to-do" list. I think I'll probably be doing something on this sometime in the near future. Best wishes!

    • @amanrastogi5184
      @amanrastogi5184 4 роки тому

      Thank you, Sir.

  • @GOGSA007
    @GOGSA007 4 роки тому

    Why are the standard errors for the variance for the intercept-only model different than those given in the book? I have also tried to replicate this example and I am getting the same results as yours, however, in the book this seems not to be the case.
    P.S. I have also tried to replicate the 3-level example and I have the same problem. However, the fixed effect coefficients and standard errors are like those in the book for both the 2- and 3-level models.

    • @mikecrowson2462
      @mikecrowson2462  4 роки тому

      Hi Georgi, thanks for your question. In the preface that most of the analyses carried out in the text are done using HLM (the program by Scientific Software International) - with some SEM-based approaches using MPlus. Sometimes, there are differences between programs in certain defaults (e.g., in terms of test statistics reported, such as z-test versus t-test of fixed effects) and even approaches to estimating standard errors (based on raw residuals, Pearson residuals, normalized residuals; use of robust standard errors versus no). I'll be honest, I haven't spent much time unpacking the differences between HLM and the lme4 package, but it looks like HLM uses Robust standard errors (see stat.utexas.edu/images/SSC/Site/M_HLM_Tutorialv2.pdf) by default, whereas this does not seem to be the case with 'lme4' (at least I have not found any discussion of robust standard errors in the documentation: cran.r-project.org/web/packages/lme4/lme4.pdf or cran.r-project.org/web/packages/robustlmm/vignettes/rlmer.pdf). This is further supported by a post here arxiv.org/abs/1612.04911 and article here (www.jstatsoft.org/index.php/jss/article/view/v087c01/v87c01.pdf) where the authors review their strategy for obtaining these standard errors when using lme4. Hope this helps!

    • @GOGSA007
      @GOGSA007 4 роки тому

      @@mikecrowson2462 Thank you for the prompt response! This could indeed be the case so I will have a look at the sources you provided (just to let you know the first link you provided requires permission to access the site). It is slightly disturbing, though, because in Hox's analysis in the book the variances are statistically significant, while when you perform the analysis with the lme4 package, they are not. I will look into that and if something comes up I will give you a shout here. Thanks again and keep up with the nice work you're sharing with us!

  • @amanrastogi5184
    @amanrastogi5184 4 роки тому

    Can we include the random slope of 2nd level predictor in a 2 level model? and if yes, then what will this mean? and if not then where am i going wrong? Thank You.

    • @mikecrowson2462
      @mikecrowson2462  4 роки тому

      Hi Aman, in general, the more complex your model becomes, the more likely you might run into problems with model convergence (that is because you are estimating additional parameters; by the way, if you specify an unstructured matrix, then it's even more complex as you will have variances and covariances among all randomly varying intercepts and slopes). But apart from this kind of issue there is no prohibition against specifying more than a single slope as randomly varying. Cheers!

    • @amanrastogi5184
      @amanrastogi5184 4 роки тому

      @@mikecrowson2462 thank you Sir.

    • @amanrastogi5184
      @amanrastogi5184 4 роки тому

      @@mikecrowson2462 But the question stands that if i include a random slope of top level predictor then will than mean to a lower level outcome variable.?