Toggle navigation
session9
0.1.0
Lecture and Lab
Lecture notes
Lecture notes PDF
Lab materials
Lecture
Learning Objectives
Identify and define hierarchical and longitudinal data
Analyze correlated data using Analysis of Variance
Define and calculate Intraclass Correlation
Identify and define random and fixed effects
Textbook sections:
Vittinghoff sections 7.1 (7.2-7.3 next class)
Outline
Introduction to hierarchical and longitudinal data
Fecal Fat example
Correlations within subjects (ICC)
Random and fixed effects
Lab
Learning Objectives
Create and interpret a notched barplot
Create spaghetti / line plots for grouped data
Use
pivot_wider
to create a wide-format dataframe
Do a manual ICC calculation
Write a function
Perform a permutation simulation
Exercises
Read the fecal fat dataset and convert pilltype and subject to factors
Create a notched boxplot of the data.
Interpret the notches. What is wrong with the usual interpretation in this example?
Subtract subject means from the fecal fat data, manually and using residuals of a one-way AOV
Make line plots for each subject, with and without subject mean centering
Convert to a wide-format dataset and remove the subject column
Write a function to calculate subject and residual variance and ICC of this dataset as a vector
Create a simulated dataset where subjects are randomized for each treatment
compare ICC for your original and simulated dataset
Repeat the simulation 999 times, and compare to your original dataset
Links
Browse source code
Full course notes
git clone
License
Full license
CC BY 4.0
Citation
Citing session9
Developers
Levi Waldron
Author, maintainer
Dev status