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

  Рет қаралды 46,728

Mike Crowson

Mike Crowson

Күн бұрын

This video demonstrates how to use R to perform multilevel modeling using the 'lme4' package in R. The demonstration pivots off the presentation from Chapter 2 of Hox (2010) using student data (with students nested within classrooms). You can access the most recent edition of Hox's book here: www.routledge.com/Multilevel-...
You can obtain a copy of the .RData file used in the video here:
drive.google.com/file/d/1F06w...
A copy of the text file I put together for the video can be downloaded here:
drive.google.com/file/d/1asbF...
Supplemental powerpoint:
drive.google.com/file/d/1kKqr...
IF YOU FOUND THE VIDEO AND SUPPORTING MATERIALS HELPFUL PLEASE 'LIKE' AND SHARE THE LINK WITH OTHERS!
For more videos and materials on multilevel modeling, please check out the following site:
sites.google.com/view/statist...

Пікірлер: 43
@stinesorensen5397
@stinesorensen5397 4 жыл бұрын
Very useful demonstration. Thank you for sharing Mike!
@dipeshsharma7869
@dipeshsharma7869 4 жыл бұрын
Wonderful video..thank you for uploading !!
@renasfpolis
@renasfpolis 2 жыл бұрын
Thanks for the video! Much appreciated.
@jaykay9835
@jaykay9835 Жыл бұрын
Thank you so much!! You helped me significantly during my bachelor's thesis
@jamescutler428
@jamescutler428 2 жыл бұрын
Great video! Very helpful details.
@dobariyahardik3388
@dobariyahardik3388 2 жыл бұрын
thank you very much sir ,Your video is very helpful
@md.masumbillah8222
@md.masumbillah8222 2 жыл бұрын
Thank you for sharing this
@konradhryniewicz7388
@konradhryniewicz7388 3 жыл бұрын
Nice video :))) thanks!
@mikecrowson2462
@mikecrowson2462 3 жыл бұрын
You are very welcome!
@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.
@fangjingtu5840
@fangjingtu5840 3 жыл бұрын
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?
@saeidnosrati3782
@saeidnosrati3782 2 жыл бұрын
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?
@junli7200
@junli7200 3 жыл бұрын
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
@julieyananzhu1134
@julieyananzhu1134 3 жыл бұрын
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 3 жыл бұрын
Yes you are right. I presented as my way for pedagogical purposes. Cheers!
@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
@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
@itofernando1379
@itofernando1379 3 жыл бұрын
One question please, after generating some models, How we choose the best model to be written in the report? Thank you.
@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.
@spiousas
@spiousas 3 жыл бұрын
Is there a way to use the graph_model for three-way interactions?
@benabdallahnadia1014
@benabdallahnadia1014 3 жыл бұрын
thanks very much for this video. is-it a cross-section analysis? can we extend this model to panel data model??
@mikecrowson2462
@mikecrowson2462 3 жыл бұрын
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...
@saeidnosrati3782
@saeidnosrati3782 2 жыл бұрын
Would you please tell us how we can get model fit indices and standardized estimation in this video?
@hakeemojulari7392
@hakeemojulari7392 2 жыл бұрын
@Mike Crowson, How do I use lme4 for categorical data (both predictors and response variable) and the data contains datetime
@amanrastogi5184
@amanrastogi5184 4 жыл бұрын
Sir, Can you make a video on Multivariate Multilevel Modelling (theory + practical) ? it will be very helpful of you, Thank You.
@mikecrowson2462
@mikecrowson2462 4 жыл бұрын
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.?
@guani2155
@guani2155 3 жыл бұрын
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 3 жыл бұрын
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
@danielmax562
@danielmax562 Жыл бұрын
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
Multilevel models in R
21:34
Kasper Welbers
Рет қаралды 17 М.
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 93 МЛН
Мы никогда не были так напуганы!
00:15
Аришнев
Рет қаралды 6 МЛН
Survival skills: A great idea with duct tape #survival #lifehacks #camping
00:27
Predicting tree height with linear mixed models and lme4
16:28
Matthew Russell
Рет қаралды 10 М.
Repeated measures as a multilevel model
59:05
Andy Field
Рет қаралды 13 М.
R - Multilevel Models Lecture (Updated)
56:09
Statistics of DOOM
Рет қаралды 45 М.
(Simplified) Linear Mixed Model in R with lme()
26:17
LiquidBrain Bioinformatics
Рет қаралды 64 М.
How to perform Structural Equation Modeling (SEM) in R
5:49
AGRON Info-Tech
Рет қаралды 11 М.
Multilevel and mixed models, random and fixed part
6:40
Mikko Rönkkö
Рет қаралды 17 М.
Lecture 9.1 Introduction to Mixed Effects Models
11:13
IxD Online: UCSD & Coursera
Рет қаралды 49 М.