In this three part video series I will show you how to analyze longitudinal data using multilevel modeling in R studio. In part one of this series, I will show you how to build and interpret the unconditional means model. The unconditional means model is the null model, which includes no predictors (independent variables) or measures of time. Running the unconditional means model is to test the significance of the grand mean and intercept of your model. Building the unconditional means model is the first step in analyzing longitudinal data using multilevel modeling.
NOTE: All three videos use the "nlme" package for multilevel modeling in R studio.
Below is all the R code I used in this video. Please note that angle brackets are not allowed in youtube video descriptions, so I left notes below where the angle brackets need to be inserted within the code.
# STEP 1: Upload dataset
Data1 (insert angled bracket here)- read.csv(file.choose())
# Make sure your file is a csv file and not an excel worksheet
# STEP 2: Open "nlme" package
library(nlme)
# There are other multilevel modeling packages available such as "lme4"
# STEP 3: Examine headers of your data (not required)
head(Data1)
# STEP 4: Run unconditional means model with summary - Using ID as the random effect.
mod1(insert angled bracket here)-lme(Job_Performance~1,random=~1|ID,data=Data1,method="ML")
summary(mod1)
# IMPORTANT NOTES ABOUT THIS MODEL
# No predictors in the model (no independent variables)
# This is the null model (beginning of intercept only)
# Time is not being measured within this model
# Measuring the grand mean here
# STEP 5: Run intervals for unconditional means model
intervals(mod1)
# STEP 6: Calculate intra-class correlation coefficient (ICC) for the unconditional means model
# ID
(1.181938^2) / ((1.181938^2) + (1.191976^2))