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?
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 ?
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.
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.
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
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.
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?
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?
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?
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
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
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!
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.
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!
@@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!
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.
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!
@@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.?
Thank you so much!! You helped me significantly during my bachelor's thesis
Thanks for the video! Much appreciated.
Very useful demonstration. Thank you for sharing Mike!
Great video! Very helpful details.
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?
thank you very much sir ,Your video is very helpful
@Mike Crowson, How do I use lme4 for categorical data (both predictors and response variable) and the data contains datetime
One question please, after generating some models, How we choose the best model to be written in the report? Thank you.
Thank you for sharing this
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 ?
You can use the "quasipoisson" as the family or the negative binomial model
Wonderful video..thank you for uploading !!
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.
Would you please tell us how we can get model fit indices and standardized estimation in this video?
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.
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
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.
Yes you are right. I presented as my way for pedagogical purposes. Cheers!
Nice video :))) thanks!
You are very welcome!
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?
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
@@guani2155 ditto. did you do the rest in r vs. r studio?
@@daviddearlove Hi David, I was using R studio
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?
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?
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
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
thanks very much for this video. is-it a cross-section analysis? can we extend this model to panel data model??
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!
@@mikecrowson2462 thank you very much...
Is there a way to use the graph_model for three-way interactions?
Sir, Can you make a video on Multivariate Multilevel Modelling (theory + practical) ? it will be very helpful of you, Thank You.
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!
Thank you, Sir.
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.
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!
@@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!
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.
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!
@@mikecrowson2462 thank you Sir.
@@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.?