SlideShare a Scribd company logo
1 of 41
Download to read offline
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab
Recap
• Last week, we created a model of middle
schoolers’ math performance that included a
random intercept for Classroom
• model1 <- lmer(FinalMathScore ~ 1 + TOI +
(1|Classroom), data=math)
Fixed effect of
naive theory
of intelligence
Average
intercept
(averaged all
classrooms)
Variance in
that intercept
from one class
to the next
Residual
(unexplained)
variance at
the child level
Notation
• What is this model doing mathematically?
• Let’s go back to our model of individual students
(now slightly different):
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Baseline
Yi(j) B0j
Fixed mindset
γ10x1i(j)
Notation
• What is this model doing mathematically?
• Let’s go back to our model of individual students
(now slightly different):
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Baseline
Yi(j) B0j
Fixed mindset
γ10x1i(j)
What now determines the baseline that
we should expect for students with
fixed mindset=0?
Notation
• What is this model doing mathematically?
• Baseline (intercept) for a student in classroom j
now depends on two things:
• Let’s go back to our model of individual students
(now slightly different):
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Baseline
Yi(j) B0j
Fixed mindset
γ10x1i(j)
U0j
=
Intercept
+
Overall intercept
across everyone
B0j γ00
Teacher effect for this
classroom (Error)
Notation
• Essentially, we have two regression models
• Hierarchical linear model
• Model of classroom j:
• Model of student i:
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Baseline
Yi(j) B0j
Fixed mindset
γ10x1i(j)
U0j
=
Intercept
+
B0j γ00
Teacher effect for this
classroom (Error)
LEVEL-1
MODEL
(Student)
LEVEL-2
MODEL
(Classroom)
Overall intercept
across everyone
Hierarchical Linear Model
Student
1
Student
2
Student
3
Student
4
Level-1 model:
Sampled STUDENTS
Mr.
Wagner’s
Class
Ms.
Fulton’s
Class
Ms.
Green’s
Class
Ms.
Cornell’s
Class
Level-2 model:
Sampled
CLASSROOMS
• Level-2 model is for the superordinate level here,
Level-1 model is for the subordinate level
Variance of classroom intercept is
the error variance at Level 2
Residual is the error variance at
Level 1
Notation
• Two models seems confusing. But we can simplify
with some algebra…
• Model of classroom j:
• Model of student i:
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Baseline
Yi(j) B0j
Fixed mindset
γ10x1i(j)
U0j
=
Intercept
+
B0j γ00
Teacher effect for this
classroom (Error)
LEVEL-1
MODEL
(Student)
LEVEL-2
MODEL
(Classroom)
Overall intercept
across everyone
Notation
• Substitution gives us a single model that combines
level-1 and level-2
• Mixed effects model
• Combined model:
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Yi(j)
Fixed mindset
γ10x1i(j)
U0j
+
Overall
intercept
γ00
Teacher effect for this
classroom (Error)
Notation
• Just two slightly different ways of writing the same
thing. Notation difference, not statistical!
• Mixed effects model:
• Hierarchical linear model:
Ei(j)
= + +
Yi(j)
γ10x1i(j)
U0j
+
γ00
Ei(j)
=
Yi(j) B0j
γ10x1i(j)
U0j
= +
B0j γ00
+ +
Notation
• lme4 always uses the mixed-effects model notation
• lmer(
FinalMathScore ~ 1 + TOI + (1|Classroom)
)
• (Level-1 error is always implied, don’t have to
include)
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Yi(j)
Fixed mindset
γ10x1i(j) U0j
+
Overall
intercept
γ00
Teacher
effect
for this
class (Error)
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab
! We’re continuing our study of naïve theories of
intelligence & math performance
! We’ve now collected data at three different
schools
! math1.csv from Jefferson Middle School
! math2.csv from Highland Middle School
! math3.csv from Hoover Middle School
Combining Datasets in R
Combining Datasets in R
! Look at the math1, math2, math3 dataframes
! How are they similar? How are they different?
! TOI and final math score for each student
Combining Datasets in R
! Look at the math1, math2, math3 dataframes
! How are they similar? How are they different?
! TOI and final math score for each student
Columns not always in same order
Combining Datasets in R
! Look at the math1, math2, math3 dataframes
! How are they similar? How are they different?
! TOI and final math score for each student
Only Hoover has GPA
reported
Combining Datasets in R
! Overall, this is similar information, so let’s
combine it all
! Paste together the rows from two (or more)
dataframes to create a new one:
! bind_rows(math1, math2, math3) -> math
! Useful when observations are spread across files
! Or, to create a dataframe that combines 2 filtered
dataframes
math1
math2
math3
math
bind_rows(): Results
! Resulting dataframe:
! nrow(math) is 720 – all three combined
math1
math2
math3
math
! Resulting dataframe:
! bind_rows() is smart!
! Not a problem that column order varies across
dataframes
! Looks at the column names
! Not a problem that GPA column only existed in one of
the original dataframes
! NA (missing data) for the students at the other schools
bind_rows(): Results
bind_rows(): Results
! Resulting dataframe:
! You can also add the optional .id argument
! bind_rows(math1, math2, math3,
.id='OriginalDataframe’) -> math
! Adds another column that tracks which of the original
dataframes (by number) each observation came from
Other, Similar Functions
! bind_rows() pastes together every row from
every dataframe, even if there are duplicates
! If you want to skip duplicates, use union()
! Same syntax as bind_rows(), just different function name
! Other related functions:
! intersect(): Keep only the rows that appear in all of
the source dataframes
! setdiff(): Keep only the rows that appear in a single
source dataframe—if duplicates, delete both copies
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab
Multiple Random Effects
• Schools could differ in math achievement—let’s add
School to the model to control for that
• Is SCHOOL a fixed effect or a random effect?
• These schools are just a sample of possible schools of
interest " Random effect.
School
1
School
2
Sampled SCHOOLS
Sampled
CLASSROOMS
Sampled STUDENTS
LEVEL 3
LEVEL 2
LEVEL 1
Student
1
Student
2
Student
3
Student
4
Mr.
Wagner’s
Class
Ms.
Fulton’s
Class
Ms.
Green’s
Class
Ms.
Cornell’s
Class
Multiple Random Effects
• No problem to have more than 1 random effect in
the model! Let’s a random intercept for School.
School
1
School
2
Sampled SCHOOLS
Sampled
CLASSROOMS
Sampled STUDENTS
LEVEL 3
LEVEL 2
LEVEL 1
Student
1
Student
2
Student
3
Student
4
Mr.
Wagner’s
Class
Ms.
Fulton’s
Class
Ms.
Green’s
Class
Ms.
Cornell’s
Class
Multiple Random Effects
• model2 <- lmer(FinalMathScore ~ 1 + TOI
+ (1|Classroom) + (1|School), data=math)
School
1
School
2
Sampled SCHOOLS
Sampled
CLASSROOMS
Sampled STUDENTS
LEVEL 3
LEVEL 2
LEVEL 1
Student
1
Student
2
Student
3
Student
4
Mr.
Wagner’s
Class
Ms.
Fulton’s
Class
Ms.
Green’s
Class
Ms.
Cornell’s
Class
Multiple Random Effects
• model2 <- lmer(FinalMathScore ~ 1 + TOI
+ (1|Classroom) + (1|School), data=math)
• Less variability across schools than classrooms in a school
Multiple Random Effects
• This is an example of nested random effects.
• Each classroom is always in the same school.
• We’ll look at crossed random effects next week
School
1
School
2
Sampled SCHOOLS
Sampled
CLASSROOMS
Sampled STUDENTS
LEVEL 3
LEVEL 2
LEVEL 1
Student
1
Student
2
Student
3
Student
4
Mr.
Wagner’s
Class
Ms.
Fulton’s
Class
Ms.
Green’s
Class
Ms.
Cornell’s
Class
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab
Level-2 Variables
• So far, all our model says about classrooms is
that they’re different
• Some classrooms have a large intercept
• Some classrooms have a small intercept
• But, we might also have some interesting
variables that characterize classrooms
• They might even be our main research interest!
• How about teacher theories of intelligence?
• Might affect how they interact with & teach students
Level-2 Variables
Student
1
Student
2
Student
3
Student
4
Sampled STUDENTS
Mr.
Wagner’s
Class
Ms.
Fulton’s
Class
Ms.
Green’s
Class
Ms.
Cornell’s
Class
Sampled
CLASSROOMS
• TeacherTheory characterizes Level 2
• All students in the same classroom will experience
the same TeacherTheory
LEVEL 2
LEVEL 1
TeacherTheory
TOI
Level-2 Variables
• Is TeacherTheory a fixed effect or random
effect?
• Teacher mindset is a fixed-effect variable
• We ARE interested in the effects of teacher mindset
on student math achievement … a research
question, not just something to control for
• Even if we ran this with a new random sample of 30
teachers, we WOULD hope to replicate whatever
regression slope for teacher mindset we observe
(whereas we wouldn’t get the same 30 teachers
back)
Level-2 Variables
• This becomes another variable in the level-2
model of classroom differences
• Tells us what we can expect this classroom to be like
Student
Error
Ei(j)
=
End-of-year math
exam score
+ +
Baseline
Yi(j) B0j
Growth mindset
γ10x1i(j)
U0j
=
Intercept
+
Overall
intercept
B0j
γ00
Teacher effect for this
classroom (Error)
LEVEL-1
MODEL
(Student)
LEVEL-2
MODEL
(Classroom)
Teacher
mindset
+
γ20x20j
Level-2 Variables
• Since R uses mixed effects notation, we don’t
have to do anything special to add a level-2
variable to the model
• model3 <- lmer(FinalMathScore ~ 1 + TOI
+ TeacherTheory + (1|Classroom) +
(1|School), data=math)
• R automatically figures out TeacherTheory is a
level-2 variable because it’s invariant for each
classroom
• We keep the random intercept for Classroom
because we don’t expect TeacherTheory will
explain all of the classroom differences. Intercept
captures residual differences.
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab
What Changes? What Doesn’t?
• Random classroom & school variance is reduced.
• Teacher theories of intelligence accounts for some of the variance
among classrooms (and among the schools those classrooms are in).
• TeacherTheory explains some of the “Class j” effect we’re substituting
into the level 1 equation. No longer just a random intercept.
WITHOUT TEACHERTHEORY WITH TEACHERTHEORY
What Changes? What Doesn’t?
• Residual error at level 1 essentially unchanged.
• Describes how students vary from the class average
• Divergence from the class average cannot be explained by teacher
• Regardless of what explains the “Class j” effect, you’re still substituting it
into the same Lv 1 model
WITHOUT TEACHERTHEORY WITH TEACHERTHEORY
What Changes? What Doesn’t?
• Similarly, our level-1 fixed effect is essentially unchanged
• Explaining where level-2 variation comes from does not change our
level-1 model
• Note that average student TOI and TeacherTheory are very slightly
correlated (due to random chance); otherwise, there’d be no change.
WITHOUT TEACHERTHEORY WITH TEACHERTHEORY
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab
Cross-Level Interactions
• Because R uses mixed effects notation, it’s also
very easy to add interactions between level-1
and level-2 variables
• model4 <- lmer(FinalMathScore ~ 1 + TOI
+ TeacherTheory + TOI:TeacherTheory +
(1|Classroom) + (1|School), data=math)
• Does the effect of a student’s theory of intelligence
depend on what the teacher’s theory is?
• e.g., maybe matching theories is beneficial
Cross-Level Interactions
• Because R uses mixed effects notation, it’s also
very easy to add interactions between level-1
and level-2 variables
• In this case, the interaction is not significant
Week 5.1: Level-2 Variables
! Notation
! Multiple Random Effects
! Combining Datasets in R
! Modeling
! Level-2 Variables
! Including Level-2 Variables in R
! Modeling Consequences
! Cross-Level Interactions
! Lab

More Related Content

What's hot

Mixed Effects Models - Missing Data
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing DataScott Fraundorf
 
Mixed Effects Models - Simple and Main Effects
Mixed Effects Models - Simple and Main EffectsMixed Effects Models - Simple and Main Effects
Mixed Effects Models - Simple and Main EffectsScott Fraundorf
 
Mixed Effects Models - Random Intercepts
Mixed Effects Models - Random InterceptsMixed Effects Models - Random Intercepts
Mixed Effects Models - Random InterceptsScott Fraundorf
 
Mixed Effects Models - Signal Detection Theory
Mixed Effects Models - Signal Detection TheoryMixed Effects Models - Signal Detection Theory
Mixed Effects Models - Signal Detection TheoryScott Fraundorf
 
Mixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsScott Fraundorf
 
Mixed Effects Models - Crossed Random Effects
Mixed Effects Models - Crossed Random EffectsMixed Effects Models - Crossed Random Effects
Mixed Effects Models - Crossed Random EffectsScott Fraundorf
 
Mixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationScott Fraundorf
 
Mixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve AnalysisMixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve AnalysisScott Fraundorf
 
Mixed Effects Models - Power
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - PowerScott Fraundorf
 
Mixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical LogitMixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical LogitScott Fraundorf
 
Mixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeScott Fraundorf
 
Mixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingMixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingScott Fraundorf
 
Mixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsScott Fraundorf
 
Functions based algebra 1 pesentation to department 042312
Functions based algebra 1 pesentation to department 042312Functions based algebra 1 pesentation to department 042312
Functions based algebra 1 pesentation to department 042312maryannfoss
 
Assignment 1 (to be submitted through the assignment submiss
Assignment 1 (to be submitted through the assignment submissAssignment 1 (to be submitted through the assignment submiss
Assignment 1 (to be submitted through the assignment submisslicservernoida
 
G6 m4-h-lesson 31-t
G6 m4-h-lesson 31-tG6 m4-h-lesson 31-t
G6 m4-h-lesson 31-tmlabuski
 
Fostering Systems Thinking in Your Students
Fostering Systems Thinking in Your StudentsFostering Systems Thinking in Your Students
Fostering Systems Thinking in Your StudentsSERC at Carleton College
 
Automated Models for Quantifying Centrality of Survey Responses
Automated Models for Quantifying Centrality of Survey ResponsesAutomated Models for Quantifying Centrality of Survey Responses
Automated Models for Quantifying Centrality of Survey ResponsesMatthew Lease
 

What's hot (20)

Mixed Effects Models - Missing Data
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing Data
 
Mixed Effects Models - Simple and Main Effects
Mixed Effects Models - Simple and Main EffectsMixed Effects Models - Simple and Main Effects
Mixed Effects Models - Simple and Main Effects
 
Mixed Effects Models - Random Intercepts
Mixed Effects Models - Random InterceptsMixed Effects Models - Random Intercepts
Mixed Effects Models - Random Intercepts
 
Mixed Effects Models - Signal Detection Theory
Mixed Effects Models - Signal Detection TheoryMixed Effects Models - Signal Detection Theory
Mixed Effects Models - Signal Detection Theory
 
Mixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit Models
 
Mixed Effects Models - Crossed Random Effects
Mixed Effects Models - Crossed Random EffectsMixed Effects Models - Crossed Random Effects
Mixed Effects Models - Crossed Random Effects
 
Mixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - Autocorrelation
 
Mixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve AnalysisMixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve Analysis
 
Mixed Effects Models - Power
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - Power
 
Mixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical LogitMixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical Logit
 
Mixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect Size
 
Mixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingMixed Effects Models - Data Processing
Mixed Effects Models - Data Processing
 
Mixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive Statistics
 
Functions based algebra 1 pesentation to department 042312
Functions based algebra 1 pesentation to department 042312Functions based algebra 1 pesentation to department 042312
Functions based algebra 1 pesentation to department 042312
 
Assignment 1 (to be submitted through the assignment submiss
Assignment 1 (to be submitted through the assignment submissAssignment 1 (to be submitted through the assignment submiss
Assignment 1 (to be submitted through the assignment submiss
 
Joseph Jay Williams - WESST - Bridging Research via MOOClets and Collaborativ...
Joseph Jay Williams - WESST - Bridging Research via MOOClets and Collaborativ...Joseph Jay Williams - WESST - Bridging Research via MOOClets and Collaborativ...
Joseph Jay Williams - WESST - Bridging Research via MOOClets and Collaborativ...
 
G6 m4-h-lesson 31-t
G6 m4-h-lesson 31-tG6 m4-h-lesson 31-t
G6 m4-h-lesson 31-t
 
Fostering Systems Thinking in Your Students
Fostering Systems Thinking in Your StudentsFostering Systems Thinking in Your Students
Fostering Systems Thinking in Your Students
 
Automated Models for Quantifying Centrality of Survey Responses
Automated Models for Quantifying Centrality of Survey ResponsesAutomated Models for Quantifying Centrality of Survey Responses
Automated Models for Quantifying Centrality of Survey Responses
 
Joseph Jay Williams - WESST - Bridging Research and Practice via MOOClets & C...
Joseph Jay Williams - WESST - Bridging Research and Practice via MOOClets & C...Joseph Jay Williams - WESST - Bridging Research and Practice via MOOClets & C...
Joseph Jay Williams - WESST - Bridging Research and Practice via MOOClets & C...
 

Similar to Mixed Effects Models - Level-2 Variables

UNC CETL - JiTT - Making It Shine - Nov 2015
UNC CETL - JiTT - Making It Shine - Nov 2015UNC CETL - JiTT - Making It Shine - Nov 2015
UNC CETL - JiTT - Making It Shine - Nov 2015Jeff Loats
 
Math grade 1 training
Math grade 1 trainingMath grade 1 training
Math grade 1 trainingAnthony Smith
 
Solving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson planSolving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson planJosephine Neff
 
Math grade 2 training
Math grade 2 trainingMath grade 2 training
Math grade 2 trainingAnthony Smith
 
Agilemind presentation
Agilemind presentationAgilemind presentation
Agilemind presentationteufelsdroch
 
Maply TA - Toby Bailey
Maply TA - Toby BaileyMaply TA - Toby Bailey
Maply TA - Toby BaileyEdUniSciEng
 
An accurate ability evaluation method for every student with small problem it...
An accurate ability evaluation method for every student with small problem it...An accurate ability evaluation method for every student with small problem it...
An accurate ability evaluation method for every student with small problem it...Hideo Hirose
 
Accessing student performance by nlp
Accessing student performance by nlpAccessing student performance by nlp
Accessing student performance by nlpSimranAgrawal16
 
ITL516 Week One Assignment One
ITL516 Week One Assignment OneITL516 Week One Assignment One
ITL516 Week One Assignment OneMeganWaldeck
 
M098 Syllabus Fall 2011
M098 Syllabus Fall 2011M098 Syllabus Fall 2011
M098 Syllabus Fall 2011chairsty
 
Proposal for Assessment and Feedback
Proposal for Assessment and FeedbackProposal for Assessment and Feedback
Proposal for Assessment and Feedbacksarrrer
 
Math 205 syllabus Fall 2012
Math 205 syllabus Fall 2012Math 205 syllabus Fall 2012
Math 205 syllabus Fall 2012Jeneva Clark
 
Evaluating functions basic rules (day 3)
Evaluating functions   basic rules (day 3)Evaluating functions   basic rules (day 3)
Evaluating functions basic rules (day 3)julienorman80065
 
Math replacement program information.11.12
Math replacement program information.11.12Math replacement program information.11.12
Math replacement program information.11.12Matt Coaty
 
Action research on grading and assessment practices of grade 7 mathematics
Action research on grading and assessment practices of grade 7 mathematicsAction research on grading and assessment practices of grade 7 mathematics
Action research on grading and assessment practices of grade 7 mathematicsGary Johnston
 
Memo remedial math lab proposal
Memo remedial math lab proposalMemo remedial math lab proposal
Memo remedial math lab proposalNathan Penn
 

Similar to Mixed Effects Models - Level-2 Variables (20)

UNC CETL - JiTT - Making It Shine - Nov 2015
UNC CETL - JiTT - Making It Shine - Nov 2015UNC CETL - JiTT - Making It Shine - Nov 2015
UNC CETL - JiTT - Making It Shine - Nov 2015
 
Forest Hills Mmc
Forest Hills MmcForest Hills Mmc
Forest Hills Mmc
 
Math grade 1 training
Math grade 1 trainingMath grade 1 training
Math grade 1 training
 
Math Summit
Math SummitMath Summit
Math Summit
 
Solving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson planSolving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson plan
 
Math grade 2 training
Math grade 2 trainingMath grade 2 training
Math grade 2 training
 
Agilemind presentation
Agilemind presentationAgilemind presentation
Agilemind presentation
 
Blankenship sara stage2
Blankenship sara stage2Blankenship sara stage2
Blankenship sara stage2
 
Don’t fal out techno in
Don’t fal out techno inDon’t fal out techno in
Don’t fal out techno in
 
Maply TA - Toby Bailey
Maply TA - Toby BaileyMaply TA - Toby Bailey
Maply TA - Toby Bailey
 
An accurate ability evaluation method for every student with small problem it...
An accurate ability evaluation method for every student with small problem it...An accurate ability evaluation method for every student with small problem it...
An accurate ability evaluation method for every student with small problem it...
 
Accessing student performance by nlp
Accessing student performance by nlpAccessing student performance by nlp
Accessing student performance by nlp
 
ITL516 Week One Assignment One
ITL516 Week One Assignment OneITL516 Week One Assignment One
ITL516 Week One Assignment One
 
M098 Syllabus Fall 2011
M098 Syllabus Fall 2011M098 Syllabus Fall 2011
M098 Syllabus Fall 2011
 
Proposal for Assessment and Feedback
Proposal for Assessment and FeedbackProposal for Assessment and Feedback
Proposal for Assessment and Feedback
 
Math 205 syllabus Fall 2012
Math 205 syllabus Fall 2012Math 205 syllabus Fall 2012
Math 205 syllabus Fall 2012
 
Evaluating functions basic rules (day 3)
Evaluating functions   basic rules (day 3)Evaluating functions   basic rules (day 3)
Evaluating functions basic rules (day 3)
 
Math replacement program information.11.12
Math replacement program information.11.12Math replacement program information.11.12
Math replacement program information.11.12
 
Action research on grading and assessment practices of grade 7 mathematics
Action research on grading and assessment practices of grade 7 mathematicsAction research on grading and assessment practices of grade 7 mathematics
Action research on grading and assessment practices of grade 7 mathematics
 
Memo remedial math lab proposal
Memo remedial math lab proposalMemo remedial math lab proposal
Memo remedial math lab proposal
 

Recently uploaded

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 

Recently uploaded (20)

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 

Mixed Effects Models - Level-2 Variables

  • 1. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab
  • 2. Recap • Last week, we created a model of middle schoolers’ math performance that included a random intercept for Classroom • model1 <- lmer(FinalMathScore ~ 1 + TOI + (1|Classroom), data=math) Fixed effect of naive theory of intelligence Average intercept (averaged all classrooms) Variance in that intercept from one class to the next Residual (unexplained) variance at the child level
  • 3. Notation • What is this model doing mathematically? • Let’s go back to our model of individual students (now slightly different): Student Error Ei(j) = End-of-year math exam score + + Baseline Yi(j) B0j Fixed mindset γ10x1i(j)
  • 4. Notation • What is this model doing mathematically? • Let’s go back to our model of individual students (now slightly different): Student Error Ei(j) = End-of-year math exam score + + Baseline Yi(j) B0j Fixed mindset γ10x1i(j) What now determines the baseline that we should expect for students with fixed mindset=0?
  • 5. Notation • What is this model doing mathematically? • Baseline (intercept) for a student in classroom j now depends on two things: • Let’s go back to our model of individual students (now slightly different): Student Error Ei(j) = End-of-year math exam score + + Baseline Yi(j) B0j Fixed mindset γ10x1i(j) U0j = Intercept + Overall intercept across everyone B0j γ00 Teacher effect for this classroom (Error)
  • 6. Notation • Essentially, we have two regression models • Hierarchical linear model • Model of classroom j: • Model of student i: Student Error Ei(j) = End-of-year math exam score + + Baseline Yi(j) B0j Fixed mindset γ10x1i(j) U0j = Intercept + B0j γ00 Teacher effect for this classroom (Error) LEVEL-1 MODEL (Student) LEVEL-2 MODEL (Classroom) Overall intercept across everyone
  • 7. Hierarchical Linear Model Student 1 Student 2 Student 3 Student 4 Level-1 model: Sampled STUDENTS Mr. Wagner’s Class Ms. Fulton’s Class Ms. Green’s Class Ms. Cornell’s Class Level-2 model: Sampled CLASSROOMS • Level-2 model is for the superordinate level here, Level-1 model is for the subordinate level Variance of classroom intercept is the error variance at Level 2 Residual is the error variance at Level 1
  • 8. Notation • Two models seems confusing. But we can simplify with some algebra… • Model of classroom j: • Model of student i: Student Error Ei(j) = End-of-year math exam score + + Baseline Yi(j) B0j Fixed mindset γ10x1i(j) U0j = Intercept + B0j γ00 Teacher effect for this classroom (Error) LEVEL-1 MODEL (Student) LEVEL-2 MODEL (Classroom) Overall intercept across everyone
  • 9. Notation • Substitution gives us a single model that combines level-1 and level-2 • Mixed effects model • Combined model: Student Error Ei(j) = End-of-year math exam score + + Yi(j) Fixed mindset γ10x1i(j) U0j + Overall intercept γ00 Teacher effect for this classroom (Error)
  • 10. Notation • Just two slightly different ways of writing the same thing. Notation difference, not statistical! • Mixed effects model: • Hierarchical linear model: Ei(j) = + + Yi(j) γ10x1i(j) U0j + γ00 Ei(j) = Yi(j) B0j γ10x1i(j) U0j = + B0j γ00 + +
  • 11. Notation • lme4 always uses the mixed-effects model notation • lmer( FinalMathScore ~ 1 + TOI + (1|Classroom) ) • (Level-1 error is always implied, don’t have to include) Student Error Ei(j) = End-of-year math exam score + + Yi(j) Fixed mindset γ10x1i(j) U0j + Overall intercept γ00 Teacher effect for this class (Error)
  • 12. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab
  • 13. ! We’re continuing our study of naïve theories of intelligence & math performance ! We’ve now collected data at three different schools ! math1.csv from Jefferson Middle School ! math2.csv from Highland Middle School ! math3.csv from Hoover Middle School Combining Datasets in R
  • 14. Combining Datasets in R ! Look at the math1, math2, math3 dataframes ! How are they similar? How are they different? ! TOI and final math score for each student
  • 15. Combining Datasets in R ! Look at the math1, math2, math3 dataframes ! How are they similar? How are they different? ! TOI and final math score for each student Columns not always in same order
  • 16. Combining Datasets in R ! Look at the math1, math2, math3 dataframes ! How are they similar? How are they different? ! TOI and final math score for each student Only Hoover has GPA reported
  • 17. Combining Datasets in R ! Overall, this is similar information, so let’s combine it all ! Paste together the rows from two (or more) dataframes to create a new one: ! bind_rows(math1, math2, math3) -> math ! Useful when observations are spread across files ! Or, to create a dataframe that combines 2 filtered dataframes math1 math2 math3 math
  • 18. bind_rows(): Results ! Resulting dataframe: ! nrow(math) is 720 – all three combined math1 math2 math3 math
  • 19. ! Resulting dataframe: ! bind_rows() is smart! ! Not a problem that column order varies across dataframes ! Looks at the column names ! Not a problem that GPA column only existed in one of the original dataframes ! NA (missing data) for the students at the other schools bind_rows(): Results
  • 20. bind_rows(): Results ! Resulting dataframe: ! You can also add the optional .id argument ! bind_rows(math1, math2, math3, .id='OriginalDataframe’) -> math ! Adds another column that tracks which of the original dataframes (by number) each observation came from
  • 21. Other, Similar Functions ! bind_rows() pastes together every row from every dataframe, even if there are duplicates ! If you want to skip duplicates, use union() ! Same syntax as bind_rows(), just different function name ! Other related functions: ! intersect(): Keep only the rows that appear in all of the source dataframes ! setdiff(): Keep only the rows that appear in a single source dataframe—if duplicates, delete both copies
  • 22. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab
  • 23. Multiple Random Effects • Schools could differ in math achievement—let’s add School to the model to control for that • Is SCHOOL a fixed effect or a random effect? • These schools are just a sample of possible schools of interest " Random effect. School 1 School 2 Sampled SCHOOLS Sampled CLASSROOMS Sampled STUDENTS LEVEL 3 LEVEL 2 LEVEL 1 Student 1 Student 2 Student 3 Student 4 Mr. Wagner’s Class Ms. Fulton’s Class Ms. Green’s Class Ms. Cornell’s Class
  • 24. Multiple Random Effects • No problem to have more than 1 random effect in the model! Let’s a random intercept for School. School 1 School 2 Sampled SCHOOLS Sampled CLASSROOMS Sampled STUDENTS LEVEL 3 LEVEL 2 LEVEL 1 Student 1 Student 2 Student 3 Student 4 Mr. Wagner’s Class Ms. Fulton’s Class Ms. Green’s Class Ms. Cornell’s Class
  • 25. Multiple Random Effects • model2 <- lmer(FinalMathScore ~ 1 + TOI + (1|Classroom) + (1|School), data=math) School 1 School 2 Sampled SCHOOLS Sampled CLASSROOMS Sampled STUDENTS LEVEL 3 LEVEL 2 LEVEL 1 Student 1 Student 2 Student 3 Student 4 Mr. Wagner’s Class Ms. Fulton’s Class Ms. Green’s Class Ms. Cornell’s Class
  • 26. Multiple Random Effects • model2 <- lmer(FinalMathScore ~ 1 + TOI + (1|Classroom) + (1|School), data=math) • Less variability across schools than classrooms in a school
  • 27. Multiple Random Effects • This is an example of nested random effects. • Each classroom is always in the same school. • We’ll look at crossed random effects next week School 1 School 2 Sampled SCHOOLS Sampled CLASSROOMS Sampled STUDENTS LEVEL 3 LEVEL 2 LEVEL 1 Student 1 Student 2 Student 3 Student 4 Mr. Wagner’s Class Ms. Fulton’s Class Ms. Green’s Class Ms. Cornell’s Class
  • 28. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab
  • 29. Level-2 Variables • So far, all our model says about classrooms is that they’re different • Some classrooms have a large intercept • Some classrooms have a small intercept • But, we might also have some interesting variables that characterize classrooms • They might even be our main research interest! • How about teacher theories of intelligence? • Might affect how they interact with & teach students
  • 30. Level-2 Variables Student 1 Student 2 Student 3 Student 4 Sampled STUDENTS Mr. Wagner’s Class Ms. Fulton’s Class Ms. Green’s Class Ms. Cornell’s Class Sampled CLASSROOMS • TeacherTheory characterizes Level 2 • All students in the same classroom will experience the same TeacherTheory LEVEL 2 LEVEL 1 TeacherTheory TOI
  • 31. Level-2 Variables • Is TeacherTheory a fixed effect or random effect? • Teacher mindset is a fixed-effect variable • We ARE interested in the effects of teacher mindset on student math achievement … a research question, not just something to control for • Even if we ran this with a new random sample of 30 teachers, we WOULD hope to replicate whatever regression slope for teacher mindset we observe (whereas we wouldn’t get the same 30 teachers back)
  • 32. Level-2 Variables • This becomes another variable in the level-2 model of classroom differences • Tells us what we can expect this classroom to be like Student Error Ei(j) = End-of-year math exam score + + Baseline Yi(j) B0j Growth mindset γ10x1i(j) U0j = Intercept + Overall intercept B0j γ00 Teacher effect for this classroom (Error) LEVEL-1 MODEL (Student) LEVEL-2 MODEL (Classroom) Teacher mindset + γ20x20j
  • 33. Level-2 Variables • Since R uses mixed effects notation, we don’t have to do anything special to add a level-2 variable to the model • model3 <- lmer(FinalMathScore ~ 1 + TOI + TeacherTheory + (1|Classroom) + (1|School), data=math) • R automatically figures out TeacherTheory is a level-2 variable because it’s invariant for each classroom • We keep the random intercept for Classroom because we don’t expect TeacherTheory will explain all of the classroom differences. Intercept captures residual differences.
  • 34. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab
  • 35. What Changes? What Doesn’t? • Random classroom & school variance is reduced. • Teacher theories of intelligence accounts for some of the variance among classrooms (and among the schools those classrooms are in). • TeacherTheory explains some of the “Class j” effect we’re substituting into the level 1 equation. No longer just a random intercept. WITHOUT TEACHERTHEORY WITH TEACHERTHEORY
  • 36. What Changes? What Doesn’t? • Residual error at level 1 essentially unchanged. • Describes how students vary from the class average • Divergence from the class average cannot be explained by teacher • Regardless of what explains the “Class j” effect, you’re still substituting it into the same Lv 1 model WITHOUT TEACHERTHEORY WITH TEACHERTHEORY
  • 37. What Changes? What Doesn’t? • Similarly, our level-1 fixed effect is essentially unchanged • Explaining where level-2 variation comes from does not change our level-1 model • Note that average student TOI and TeacherTheory are very slightly correlated (due to random chance); otherwise, there’d be no change. WITHOUT TEACHERTHEORY WITH TEACHERTHEORY
  • 38. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab
  • 39. Cross-Level Interactions • Because R uses mixed effects notation, it’s also very easy to add interactions between level-1 and level-2 variables • model4 <- lmer(FinalMathScore ~ 1 + TOI + TeacherTheory + TOI:TeacherTheory + (1|Classroom) + (1|School), data=math) • Does the effect of a student’s theory of intelligence depend on what the teacher’s theory is? • e.g., maybe matching theories is beneficial
  • 40. Cross-Level Interactions • Because R uses mixed effects notation, it’s also very easy to add interactions between level-1 and level-2 variables • In this case, the interaction is not significant
  • 41. Week 5.1: Level-2 Variables ! Notation ! Multiple Random Effects ! Combining Datasets in R ! Modeling ! Level-2 Variables ! Including Level-2 Variables in R ! Modeling Consequences ! Cross-Level Interactions ! Lab