SlideShare a Scribd company logo
Week 6.1: Crossed Random Effects
! Crossed Random Effects Analysis
! Example Design
! Joining Dataframes
! Random Slopes in Crossed Designs
! Between-Subjects & Within-Subjects Designs
! Between-Items & Within-Items Designs
! When are Random Slopes Necessary?
! Practice Activity
An Experimental Dataset
• naming.csv
• RT (response time) to “name” a word (read it aloud)
for students learning English
• 60 Subjects each presented with 49 Words we
randomly picked out of a dictionary
• Each row of data is a single trial (one subject
responding to one word)
• We’re interested in YearsOfStudy (of English) and
WordFreq (frequency in the English language)
• Also interested in their interaction
• Which of these should we consider Fixed
Effects? Which are Random Effects?
An Experimental Dataset
• naming.csv
• RT (response time) to “name” a word (read it aloud)
for students learning English
• 60 Subjects each presented with 49 Words we
randomly picked out of a dictionary
• Each row of data is a single trial (one subject
responding to one word)
• We’re interested in YearsOfStudy (of English) and
WordFreq (frequency in the English language)
• Also interested in their interaction
• Which of these should we consider Fixed
Effects? Which are Random Effects?
• Fixed: YearsOfStudy, WordFreq, & interaction
• Random: Subject, Word
Crossed Random Effects
• Now, we have >1 trial per Subject
• Level-1 observations (RTs) are nested within subjects
• Clear we need to take account of this
• Some subjects will have faster RTs in general than others
Subjects (Level-2)
Trials (Level-1) RT 1 RT 2 RT 3 RT 4
Subject
1
Subject
2
Crossed Random Effects
• Here are the different Words. Do some seem
easier than others?
Probably relatively
easy
Probably relatively
hard!
Crossed Random Effects
• Each word is also used in more than 1 trial
• Want to take account of that, too
• Observations from the same item will be more similar to
one another, too (“boy” easier than “carburetor”)
Subjects (Level-2)
Trials (Level-1) RT 1 RT 2 RT 3 RT 4
Subject
1
Subject
2
Words
“Boy” “Carbu
retor”
Crossed Random Effects
• In fact, we can think of each trial as the pairing of a
subject and a word
Subjects (Level-2)
Trials (Level-1) RT 1 RT 2 RT 3 RT 4
Subject
1
Subject
2
Words (Level-2)
“Boy” “Carbu
retor”
Crossed Random Effects
• Random effects not hierarchically nested
• Before: Each classroom appears in only 1 school
• Here: Each item presented to each subject
• If we draw all the lines in, we see they cross
Subjects (Level-2)
Trials (Level-1) RT 1 RT 2 RT 3 RT 4
Subject
1
Subject
2
Words (Level-2)
“Boy” “Carbu
retor”
Crossed Random Effects
• Crossed random effects structure
• a/k/a cross-classified when we’re dealing with
existing classifications
Subjects (Level-2)
Trials (Level-1) RT 1 RT 2 RT 3 RT 4
Subject
1
Subject
2
Words (Level-2)
“Boy” “Carbu
retor”
Crossed Random Effects
• Conceptually different sampling, but same syntax!
• Let’s try fitting a model with:
• A fixed effect of YearsOfStudy
• Random intercepts for Subject and Word
• model1 <- lmer(RT ~ 1 + YearsOfStudy +
(1|Subject) + (1|Word), data=naming)
Crossed Random Effects
• Conceptually different sampling, but same syntax!
• Let’s try fitting a model with:
• A fixed effect of YearsOfStudy
• Random intercepts for Subject and Word
• model1 <- lmer(RT ~ 1 + YearsOfStudy +
(1|Subject) + (1|Word), data=naming)
Crossed Random Effects
• model1 <- lmer(RT ~ 1 + YearsOfStudy +
(1|Subject) + (1|Word), data=naming)
Significant effect
of YearsOfStudy
– more study =
faster
responding
Crossed Random Effects
• Huge improvement over ANOVA analyses in
psycholinguistics / experimental psychology!
• We used to have to conduct separate analyses to
assess generalizability over subjects & items
• Or, item effects were simply ignored!
Subjects (Level-2)
Trials (Level-1) RT 1 RT 2 RT 3 RT 4
Subject
1
Subject
2
Words (Level-2)
“Boy” “Carbu
retor”
Week 6.1: Crossed Random Effects
! Crossed Random Effects Analysis
! Example Design
! Joining Dataframes
! Random Slopes in Crossed Designs
! Between-Subjects & Within-Subjects Designs
! Between-Items & Within-Items Designs
! When are Random Slopes Necessary?
! Practice Activity
Joining Dataframes
• Let’s also look at the effect of word frequency
• Problem: This is currently saved in a separate file
(subtlexus.csv)
• SUBTLEXUS norms for US English
Joining Dataframes
! Sometimes different files/dataframes contain
different variables relevant to the same
observations
! Common scenario in mixed effects models
context: Level-2 measurements are in a different
file than Level-1 measurements
naming.csv:
1 row per trial
Each word appears
in multiple rows
subtlexus.csv:
Each word has
only one row
with its
frequency
Joining Dataframes
! Sometimes different files/dataframes contain
different variables relevant to the same
observations
! Common scenario in mixed effects models
context: Level-2 measurements are in a different
file than Level-1 measurements
1 row per
trial
Each
subject has
multiple
rows
Each subject has only
one row with their
Working Memory score
Joining Dataframes
! Sometimes different files/dataframes contain
different variables relevant to the same
observations
! Common scenario in mixed effects models
context: Level-2 variables are in a different file
than Level-1 measurements
allschools: 1 row per student
Each classroom appears in multiple rows
tutoruse.csv:
Each class has only one row—did
this class use the tutor or not?
! “Look up word frequency from the other
dataframe”
! We can combine these dataframes if they have at
least one column in common
! Word tells us which word was presented on an
individual trial, and it also identifies the word in
our database of word frequency
naming.csv:
1 row per trial
Each word
appears in
multiple rows
subtlexus.csv:
Each word has
only one row
with its
frequency
Joining Dataframes
Inner Join
! inner_join(naming, subtlexus, by='Word')
-> naming2
! New dataframe (naming2) has both the columns from
naming (Subject, YearsOfStudy, RT) and the columns
from subtlexus (WordFreq)
! Matches the observations using the Word column
naming.csv:
1 row per trial
Each word
appears in
multiple rows
subtlexus.csv:
Each word has
only one row
with its
frequency
Inner Join
! inner_join(naming, subtlexus, by='Word')
-> naming2
! New dataframe (naming2) has both the columns from
naming (Subject, YearsOfStudy, RT) and the columns
from subtlexus (WordFreq)
! Matches the observations using the Word column
! Like VLOOKUP in Excel
Joins – Mismatching Column Names
! What if the columns have different names?
! Not true in this dataset—just a hypothetical
! Item in naming tells us which Word to look for in
subtlexus … how can we tell R that?
! inner_join(naming, subtlexus,
by=c('Item'='Word')) -> naming2
Name of the column in the
dataframe we listed second
Name of the column in the
dataframe we listed first
Other Types of Joins
! nrow(naming)
! nrow(naming2)
! Six words didn’t have a frequency measurement
! An inner join will drop rows that can’t be
matched
! Alternative:
! naming2 <- left_join(naming, subtlexus,
by='Word')
Keep the rows in the first dataframe (naming)
where we can’t find the matching WORD in the
second dataframe (subtlexus)
Can you guess what happens to WordFreq for
those trials?
2940
2580
Other Types of Joins
! nrow(naming)
! nrow(naming2)
! Six words didn’t have a frequency measurement
! An inner join will drop rows that can’t be
matched
! Alternative:
! naming2 <- left_join(naming, subtlexus,
by='Word')
Keep the rows in the first dataframe (naming)
where we can’t find the matching WORD in the
second dataframe (subtlexus)
WordFreq will be NA (missing data) in these rows
2940
2580
Other Types of Joins
! nrow(naming)
! nrow(naming2)
! Six words didn’t have a frequency measurement
! An inner join will drop rows that can’t be
matched
! A left or right join will keep every row in the first
or second dataframe, respectively
! A full join keeps every row in both dataframes
! full_join(naming, subtlexus,
by='Word') -> naming3
! Includes rows for every word in the
English word frequency database, even ones
not used in our experiment. We DON’T
need or want that in this case.
2940
2580
Matching by Multiple Columns
! Sometimes, one column isn’t enough to uniquely match
things across files/dataframes
! Can use multiple columns in join functions:
! inner_join(naming, subtlexus,
by=c('Word', 'Country')) -> naming2
! This is a logical AND. Has to match both Word and Country
Imagine doing our task in both the US and UK. Word frequency differs somewhat
between American English & British English, so now we need both Word and Country to
look up the frequency.
Crossed Random Effects
• Now that we’ve added the word frequency to our
dataframe, let’s add it to the model
• model2 <- lmer(RT ~ 1 + YearsOfStudy *
WordFreq + (1|Subject) + (1|Word),
data=naming2)
Greater Subject
variance than Item
variance.
Typical in
experiments
because we often
design items to be
similar
Week 6.1: Crossed Random Effects
! Crossed Random Effects Analysis
! Example Design
! Joining Dataframes
! Random Slopes in Crossed Designs
! Between-Subjects & Within-Subjects Designs
! Between-Items & Within-Items Designs
! When are Random Slopes Necessary?
! Practice Activity
• What kind of random slopes might be relevant
here?
• To answer this question, we need to understand
how “between-subjects variables” differ from
“within-subjects variables”
Between vs. Within Subjects
Between vs. Within Subjects
• In an experimental design, some variables are:
" Between-Subjects variables: Each subject is in 1
and only 1 group … or has 1 and only 1 value
• Randomly assigned to drug 1 vs. drug 2 vs. placebo
• Demographic variables; e.g., SES
• Cognitive/linguistic differences (e.g., working mem. score)
• “Between subjects” because differences in this variable
are only seen between one subject and another
SUBJECT 10’s
DATA
Native speaker
Trial 1: Correct
Trial 2: Correct
Trial 3: Incorrect
SUBJECT 11’s
DATA
Non-native
speaker
Trial 1: Incorrect
Trial 2: Correct
Trial 3: Incorrect
Between vs. Within Subjects
• In an experimental design, some variables are:
" Between-Subjects variables: Each subject is in 1
and only 1 group … or has 1 and only 1 value
• Randomly assigned to drug 1 vs. drug 2 vs. placebo
• Demographic variables; e.g., SES
• Cognitive/linguistic differences (e.g., working mem. score)
• “Between subjects” because differences in this variable
are only seen between one subject and another
" Within-Subjects variables: Same subject sees
more than 1 condition or has >1 value
• Same subject sees both congruent (green) and
incongruent (blue) Stroop trials
• Values that vary w/in a study, e.g., # of previous trials
• Variables where you’d use a repeated measures ANOVA
• “Within-subjects” because you can see differences in this
variable even within a single subject
Between vs. Within Subjects
• In an experimental design, some variables are:
" Between-Subjects variables: Each subject is in 1
and only 1 group … or has 1 and only 1 value
• Randomly assigned to @
• Demographic variables; e.g., SES
• Cognitive/linguistic differences (e.g., working mem. score)
• “Between subjects” because differences in this variable
are only seen between one subject and another
" Within-Subjects variables: Same subject sees
more than 1 condition or has >1 value
• Same subject sees both congruent (green) and
incongruent (blue) Stroop trials
• Values that vary w/in a study, e.g., # of previous trials
• Variables where you’d use a repeated measures ANOVA
• “Within-subjects” because you can see differences in this
variable even within a single subject
SUBJECT 12’S DATA
Trial 1: Congruent Stroop, 655 ms
Trial 2: Incongruent Stroop, 512 ms
Trial 3: Incongruent Stroop, 711 ms
Trial 4: Congruent Stroop: 642 ms
• The same variable could end up as between- or
within-subjects, depending on experimental
design
• I’m interested in maintenance rehearsal (repetition)
vs. elaborative rehearsal (relating to other concepts)
• Half of my participants study second-language
vocab using maintenance rehearsal, and half study
words using elaborative rehearsal # Between
Subjects
• Each participant studies some words with
maintenance rehearsal and some with elaborative
rehearsal # Within Subjects
Between vs. Within: Advanced
• How about in our naming dataset?
• Years of study is…
• This experiment takes place at a single point in time,
so the number of years a subject has been studying
English is fixed and never varies
• Between subjects
• Word frequency is…
• Each subject sees high-, medium- and low-frequency
words
• Within subjects
Between vs. Within Subjects
When are Random Slopes
Appropriate?
• If the random effect is subject…
• Random slopes for subjects appropriate for:
• Within-subjects variables
• We can draw a regression line for each subject
• Calculate the effect “within” each subject
• Random slopes for subjects inappropriate for:
• Between-subjects variables
• Can’t draw a regression line within each subject
Subject 1 High Frequency Subject 1 Low Frequency
Subject 2 High Frequency Subject 2 Low Frequency
Subject 1: 6 years of study
Subject 2: 2 years of study
Random Slopes: Implementation
• Remember, previous model was:
• model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq
+ (1|Subject) + (1|Word), data=naming2)
• What variable varies within subjects? Try adding a
random slope for it
• model3 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq
+ ???????????????? + (1|Word),
data=naming2)
Random Slopes: Implementation
• Remember, previous model was:
• model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq
+ (1|Subject) + (1|Word), data=naming2)
• What variable varies within subjects? Try adding a
random slope for it
• model3 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq
+ (1+WordFreq|Subject) + (1|Word),
data=naming2)
Again, miniature model
formula for things we
think will vary by subjects
Subjects differ in their
intercept (baseline RT) Subjects differ in the effect of
word frequency on their RTs
Random Slopes: Implementation
• Remember, previous model was:
• model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq
+ (1|Subject) + (1|Word), data=naming2)
• What variable varies within subjects? Try adding a
random slope for it
• model3 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq
+ (1+WordFreq|Subject) + (1|Word),
data=naming2)
Random Slopes
• Original model says
that subjects vary in
baseline RT
• Random intercept
• And that a 1-unit change
in word frequency ≈ 120
ms decrease in RT
• Fixed effect across subjects
1 2 3
500
600
700
800
900
1000
1100
1200
Word frequency
RT
Subject 1
1 2 3
500
600
700
800
900
1000
1100
1200
Subject 2
1 2 3
500
600
700
800
900
1000
1100
1200
Subject 3
1 2 3
500
600
700
800
900
1000
1100
1200
Subject 4
Different intercepts
for each subject
Slope is the same for
everyone
Random Slopes
• Original model says
that subjects vary in
baseline RT
• Random intercept
• And that a 1-unit change
in word frequency ≈ 120
ms decrease in RT
• Fixed effect across subjects
• Differences in slope
capture how individual
people vary in sensitivity
to word frequency
• Random slope
• Such differences may correlate with baseline
1 2 3
500
600
700
800
900
1000
1100
1200
Word frequency
RT
Subject 1
1 2 3
500
600
700
800
900
1000
1100
1200
Subject 2
1 2 3
500
600
700
800
900
1000
1100
1200
Subject 3
1 2 3
500
600
700
800
900
1000
1100
1200
Subject 4
Subjects still vary in
intercept
Slopes now also differ
across sampled subjects
Subjects with higher
baselines also have
steeper slopes
Week 6.1: Crossed Random Effects
! Crossed Random Effects Analysis
! Example Design
! Joining Dataframes
! Random Slopes in Crossed Designs
! Between-Subjects & Within-Subjects Designs
! Between-Items & Within-Items Designs
! When are Random Slopes Necessary?
! Practice Activity
Between vs. Within Items
• We can draw a similar distinction between
" Between-Items variables: Each item appears in 1
and only 1 condition … or has 1 and only 1 value
• Visual complexity of pictures
• One set of sentences is used in our “plausible” condition
and a completely different set is used in our “implausible”
condition
• “Between items” because differences in this variable are
only seen between one item and another
" Within-Items variables: Same item appears in
more than 1 condition or has >1 value
• Same science facts presented (across subjects) in either
an elaborative- or maintenance-rehearsal condition
• We manipulate the same fictitious resume to have either
a stereotypically African-American or European-American
name
Between vs. Within Items
• Try updating the most recent model with
random slope(s) for the within-items variable(s)
• Hint: Think about whether each variable is constant
for a particular Word or not
• The final full model:
• model.Full <- lmer(RT ~
1 + YearsOfStudy * WordFreq +
(1 + WordFreq|Subject) +
?????????????? , data=naming2)
Between vs. Within Items
• Try updating the most recent model with
random slope(s) for the within-items variable(s)
• Hint: Think about whether each variable is constant
for a particular Word or not
• The final full model:
• model.Full <- lmer(RT ~
1 + YearsOfStudy * WordFreq +
(1 + WordFreq|Subject) +
(1 + YearsOfStudy|Word), data=naming2)
Between vs. Within Items
• Why didn’t we include a
random slope of WordFreq
by items?
• Each word has a constant
frequency (within this experiment)
• Doesn’t make sense to discuss effect
of word frequency within an item
• No random slope of frequency by
items
• But, each item IS presented to
different subjects who differ in their
YearsOfStudy
1 2 3 4
300
400
500
600
700
Word frequency
RT
computer
1 2 3 4
300
400
500
600
700
panther
1 2 3 4
300
400
500
600
700
verify
1 2 3 4
300
400
500
600
700
memorandum
Week 6.1: Crossed Random Effects
! Crossed Random Effects Analysis
! Example Design
! Joining Dataframes
! Random Slopes in Crossed Designs
! Between-Subjects & Within-Subjects Designs
! Between-Items & Within-Items Designs
! When are Random Slopes Necessary?
! Practice Activity
When Are Random Slopes
Necessary?
• Remember that failing to account for clustering
could inflate our Type I error rate
• With factorial experiments, standard is to at
least try to include all random slopes we can (Barr
et al., 2013)
• Maximal random effects structure
• Expectation is that we assume that subjects could
vary in, say, their WordFreq effect—that’s why we
ran more than one subject
• If this does not converge, simplify using strategies
we discussed last class (e.g., removing correlation
parameters)
When Are Random Slopes
Necessary?
• Remember that failing to account for clustering
could inflate our Type I error rate
• In more observational data, not necessarily the
case you’d include all possible random slopes
• What’s theoretically relevant or expected?
The View Ahead
• We’ve covered the basics of fitting a mixed
effects model
• You will practice this in Wednesday’s lab
• But, we have only used continuous variables
• Next 3 weeks: Categorical variables (factors)
• Next two weeks: Categorical predictors (IVs)
• e.g., experimental vs. control condition; race/ethnicity
• After that: Categorical outcomes (DVs)
• e.g., recalled vs. didn’t recall a science fact; did or didn’t
graduate high school
Week 6.1: Crossed Random Effects
! Crossed Random Effects Analysis
! Example Design
! Joining Dataframes
! Random Slopes in Crossed Designs
! Between-Subjects & Within-Subjects Designs
! Between-Items & Within-Items Designs
! When are Random Slopes Necessary?
! Practice Activity

More Related Content

What's hot

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
Scott Fraundorf
 
Mixed Effects Models - Orthogonal Contrasts
Mixed Effects Models - Orthogonal ContrastsMixed Effects Models - Orthogonal Contrasts
Mixed Effects Models - Orthogonal Contrasts
Scott Fraundorf
 
Mixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit Models
Scott Fraundorf
 
Mixed Effects Models - Model Comparison
Mixed Effects Models - Model ComparisonMixed Effects Models - Model Comparison
Mixed Effects Models - Model Comparison
Scott Fraundorf
 
Mixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical LogitMixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical Logit
Scott Fraundorf
 
Mixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve AnalysisMixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve Analysis
Scott Fraundorf
 
Null hypothesis for Mann Whitney U
Null hypothesis for Mann Whitney UNull hypothesis for Mann Whitney U
Null hypothesis for Mann Whitney U
Ken Plummer
 
Mixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - Autocorrelation
Scott Fraundorf
 
Repeated Measures ANOVA
Repeated Measures ANOVARepeated Measures ANOVA
Repeated Measures ANOVA
Kaori Kubo Germano, PhD
 
Reporting Mann Whitney U Test in APA
Reporting Mann Whitney U Test in APAReporting Mann Whitney U Test in APA
Reporting Mann Whitney U Test in APA
Ken Plummer
 
Anova (f test) and mean differentiation
Anova (f test) and mean differentiationAnova (f test) and mean differentiation
Anova (f test) and mean differentiation
Subramani Parasuraman
 
Poisson regression models for count data
Poisson regression models for count dataPoisson regression models for count data
Poisson regression models for count data
University of Southampton
 
Tutorial parametric v. non-parametric
Tutorial   parametric v. non-parametricTutorial   parametric v. non-parametric
Tutorial parametric v. non-parametric
Ken Plummer
 
Correlation VS Causation
Correlation VS CausationCorrelation VS Causation
Correlation VS Causation
Colleen Carmean
 
Multiple Linear Regression II and ANOVA I
Multiple Linear Regression II and ANOVA IMultiple Linear Regression II and ANOVA I
Multiple Linear Regression II and ANOVA I
James Neill
 
Mixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect Size
Scott Fraundorf
 
Reporting spearman rho in apa
Reporting spearman rho in apaReporting spearman rho in apa
Reporting spearman rho in apa
Ken Plummer
 
Time Series - Auto Regressive Models
Time Series - Auto Regressive ModelsTime Series - Auto Regressive Models
Time Series - Auto Regressive Models
Bhaskar T
 
Multiple linear regression
Multiple linear regressionMultiple linear regression
Multiple linear regression
Ken Plummer
 
T test, independant sample, paired sample and anova
T test, independant sample, paired sample and anovaT test, independant sample, paired sample and anova
T test, independant sample, paired sample and anova
Qasim Raza
 

What's hot (20)

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 - Orthogonal Contrasts
Mixed Effects Models - Orthogonal ContrastsMixed Effects Models - Orthogonal Contrasts
Mixed Effects Models - Orthogonal Contrasts
 
Mixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit Models
 
Mixed Effects Models - Model Comparison
Mixed Effects Models - Model ComparisonMixed Effects Models - Model Comparison
Mixed Effects Models - Model Comparison
 
Mixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical LogitMixed Effects Models - Empirical Logit
Mixed Effects Models - Empirical Logit
 
Mixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve AnalysisMixed Effects Models - Growth Curve Analysis
Mixed Effects Models - Growth Curve Analysis
 
Null hypothesis for Mann Whitney U
Null hypothesis for Mann Whitney UNull hypothesis for Mann Whitney U
Null hypothesis for Mann Whitney U
 
Mixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - Autocorrelation
 
Repeated Measures ANOVA
Repeated Measures ANOVARepeated Measures ANOVA
Repeated Measures ANOVA
 
Reporting Mann Whitney U Test in APA
Reporting Mann Whitney U Test in APAReporting Mann Whitney U Test in APA
Reporting Mann Whitney U Test in APA
 
Anova (f test) and mean differentiation
Anova (f test) and mean differentiationAnova (f test) and mean differentiation
Anova (f test) and mean differentiation
 
Poisson regression models for count data
Poisson regression models for count dataPoisson regression models for count data
Poisson regression models for count data
 
Tutorial parametric v. non-parametric
Tutorial   parametric v. non-parametricTutorial   parametric v. non-parametric
Tutorial parametric v. non-parametric
 
Correlation VS Causation
Correlation VS CausationCorrelation VS Causation
Correlation VS Causation
 
Multiple Linear Regression II and ANOVA I
Multiple Linear Regression II and ANOVA IMultiple Linear Regression II and ANOVA I
Multiple Linear Regression II and ANOVA I
 
Mixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect Size
 
Reporting spearman rho in apa
Reporting spearman rho in apaReporting spearman rho in apa
Reporting spearman rho in apa
 
Time Series - Auto Regressive Models
Time Series - Auto Regressive ModelsTime Series - Auto Regressive Models
Time Series - Auto Regressive Models
 
Multiple linear regression
Multiple linear regressionMultiple linear regression
Multiple linear regression
 
T test, independant sample, paired sample and anova
T test, independant sample, paired sample and anovaT test, independant sample, paired sample and anova
T test, independant sample, paired sample and anova
 

Similar to Mixed Effects Models - Crossed Random Effects

Text features
Text featuresText features
Text features
Shruti kar
 
Ir 03
Ir   03Ir   03
Webinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with SolrWebinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with Solr
Lucidworks
 
A-Study_TopicModeling
A-Study_TopicModelingA-Study_TopicModeling
A-Study_TopicModeling
Sardhendu Mishra
 
Some Information Retrieval Models and Our Experiments for TREC KBA
Some Information Retrieval Models and Our Experiments for TREC KBASome Information Retrieval Models and Our Experiments for TREC KBA
Some Information Retrieval Models and Our Experiments for TREC KBA
Patrice Bellot - Aix-Marseille Université / CNRS (LIS, INS2I)
 
A Panorama of Natural Language Processing
A Panorama of Natural Language ProcessingA Panorama of Natural Language Processing
A Panorama of Natural Language Processing
Ted Xiao
 
2_Capability.ppt
2_Capability.ppt2_Capability.ppt
2_Capability.ppt
Krishna20539
 
Word embeddings
Word embeddingsWord embeddings
Word embeddings
Shruti kar
 
Search pitb
Search pitbSearch pitb
Search pitb
Nawab Iqbal
 
Chapter 6 Query Language .pdf
Chapter 6 Query Language .pdfChapter 6 Query Language .pdf
Chapter 6 Query Language .pdf
Habtamu100
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
Erik Hatcher
 
Automated Software Requirements Labeling
Automated Software Requirements LabelingAutomated Software Requirements Labeling
Automated Software Requirements Labeling
Data Works MD
 
Introduction to search engine-building with Lucene
Introduction to search engine-building with LuceneIntroduction to search engine-building with Lucene
Introduction to search engine-building with Lucene
Kai Chan
 
Introduction to search engine-building with Lucene
Introduction to search engine-building with LuceneIntroduction to search engine-building with Lucene
Introduction to search engine-building with Lucene
Kai Chan
 
Text based search engine on a fixed corpus and utilizing indexation and ranki...
Text based search engine on a fixed corpus and utilizing indexation and ranki...Text based search engine on a fixed corpus and utilizing indexation and ranki...
Text based search engine on a fixed corpus and utilizing indexation and ranki...
Soham Mondal
 
Eacl 2006 Pedersen
Eacl 2006 PedersenEacl 2006 Pedersen
Search explained T3DD15
Search explained T3DD15Search explained T3DD15
Search explained T3DD15
Hans Höchtl
 
Semi-automated Exploration and Extraction of Data in Scientific Tables
Semi-automated Exploration and Extraction of Data in Scientific TablesSemi-automated Exploration and Extraction of Data in Scientific Tables
Semi-automated Exploration and Extraction of Data in Scientific Tables
Elsevier
 
Textrank algorithm
Textrank algorithmTextrank algorithm
Textrank algorithm
Andrew Koo
 
A Simple Walkthrough of Word Sense Disambiguation
A Simple Walkthrough of Word Sense DisambiguationA Simple Walkthrough of Word Sense Disambiguation
A Simple Walkthrough of Word Sense Disambiguation
MaryOsborne11
 

Similar to Mixed Effects Models - Crossed Random Effects (20)

Text features
Text featuresText features
Text features
 
Ir 03
Ir   03Ir   03
Ir 03
 
Webinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with SolrWebinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with Solr
 
A-Study_TopicModeling
A-Study_TopicModelingA-Study_TopicModeling
A-Study_TopicModeling
 
Some Information Retrieval Models and Our Experiments for TREC KBA
Some Information Retrieval Models and Our Experiments for TREC KBASome Information Retrieval Models and Our Experiments for TREC KBA
Some Information Retrieval Models and Our Experiments for TREC KBA
 
A Panorama of Natural Language Processing
A Panorama of Natural Language ProcessingA Panorama of Natural Language Processing
A Panorama of Natural Language Processing
 
2_Capability.ppt
2_Capability.ppt2_Capability.ppt
2_Capability.ppt
 
Word embeddings
Word embeddingsWord embeddings
Word embeddings
 
Search pitb
Search pitbSearch pitb
Search pitb
 
Chapter 6 Query Language .pdf
Chapter 6 Query Language .pdfChapter 6 Query Language .pdf
Chapter 6 Query Language .pdf
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
 
Automated Software Requirements Labeling
Automated Software Requirements LabelingAutomated Software Requirements Labeling
Automated Software Requirements Labeling
 
Introduction to search engine-building with Lucene
Introduction to search engine-building with LuceneIntroduction to search engine-building with Lucene
Introduction to search engine-building with Lucene
 
Introduction to search engine-building with Lucene
Introduction to search engine-building with LuceneIntroduction to search engine-building with Lucene
Introduction to search engine-building with Lucene
 
Text based search engine on a fixed corpus and utilizing indexation and ranki...
Text based search engine on a fixed corpus and utilizing indexation and ranki...Text based search engine on a fixed corpus and utilizing indexation and ranki...
Text based search engine on a fixed corpus and utilizing indexation and ranki...
 
Eacl 2006 Pedersen
Eacl 2006 PedersenEacl 2006 Pedersen
Eacl 2006 Pedersen
 
Search explained T3DD15
Search explained T3DD15Search explained T3DD15
Search explained T3DD15
 
Semi-automated Exploration and Extraction of Data in Scientific Tables
Semi-automated Exploration and Extraction of Data in Scientific TablesSemi-automated Exploration and Extraction of Data in Scientific Tables
Semi-automated Exploration and Extraction of Data in Scientific Tables
 
Textrank algorithm
Textrank algorithmTextrank algorithm
Textrank algorithm
 
A Simple Walkthrough of Word Sense Disambiguation
A Simple Walkthrough of Word Sense DisambiguationA Simple Walkthrough of Word Sense Disambiguation
A Simple Walkthrough of Word Sense Disambiguation
 

More from Scott Fraundorf

Mixed Effects Models - Power
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - Power
Scott Fraundorf
 
Mixed Effects Models - Missing Data
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing Data
Scott Fraundorf
 
Mixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 VariablesMixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 Variables
Scott Fraundorf
 
Mixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive Statistics
Scott Fraundorf
 
Mixed Effects Models - Introduction
Mixed Effects Models - IntroductionMixed Effects Models - Introduction
Mixed Effects Models - Introduction
Scott Fraundorf
 
Scott_Fraundorf_Resume
Scott_Fraundorf_ResumeScott_Fraundorf_Resume
Scott_Fraundorf_Resume
Scott Fraundorf
 

More from Scott Fraundorf (6)

Mixed Effects Models - Power
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - Power
 
Mixed Effects Models - Missing Data
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing Data
 
Mixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 VariablesMixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 Variables
 
Mixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive Statistics
 
Mixed Effects Models - Introduction
Mixed Effects Models - IntroductionMixed Effects Models - Introduction
Mixed Effects Models - Introduction
 
Scott_Fraundorf_Resume
Scott_Fraundorf_ResumeScott_Fraundorf_Resume
Scott_Fraundorf_Resume
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 

Mixed Effects Models - Crossed Random Effects

  • 1. Week 6.1: Crossed Random Effects ! Crossed Random Effects Analysis ! Example Design ! Joining Dataframes ! Random Slopes in Crossed Designs ! Between-Subjects & Within-Subjects Designs ! Between-Items & Within-Items Designs ! When are Random Slopes Necessary? ! Practice Activity
  • 2. An Experimental Dataset • naming.csv • RT (response time) to “name” a word (read it aloud) for students learning English • 60 Subjects each presented with 49 Words we randomly picked out of a dictionary • Each row of data is a single trial (one subject responding to one word) • We’re interested in YearsOfStudy (of English) and WordFreq (frequency in the English language) • Also interested in their interaction • Which of these should we consider Fixed Effects? Which are Random Effects?
  • 3. An Experimental Dataset • naming.csv • RT (response time) to “name” a word (read it aloud) for students learning English • 60 Subjects each presented with 49 Words we randomly picked out of a dictionary • Each row of data is a single trial (one subject responding to one word) • We’re interested in YearsOfStudy (of English) and WordFreq (frequency in the English language) • Also interested in their interaction • Which of these should we consider Fixed Effects? Which are Random Effects? • Fixed: YearsOfStudy, WordFreq, & interaction • Random: Subject, Word
  • 4. Crossed Random Effects • Now, we have >1 trial per Subject • Level-1 observations (RTs) are nested within subjects • Clear we need to take account of this • Some subjects will have faster RTs in general than others Subjects (Level-2) Trials (Level-1) RT 1 RT 2 RT 3 RT 4 Subject 1 Subject 2
  • 5. Crossed Random Effects • Here are the different Words. Do some seem easier than others? Probably relatively easy Probably relatively hard!
  • 6. Crossed Random Effects • Each word is also used in more than 1 trial • Want to take account of that, too • Observations from the same item will be more similar to one another, too (“boy” easier than “carburetor”) Subjects (Level-2) Trials (Level-1) RT 1 RT 2 RT 3 RT 4 Subject 1 Subject 2 Words “Boy” “Carbu retor”
  • 7. Crossed Random Effects • In fact, we can think of each trial as the pairing of a subject and a word Subjects (Level-2) Trials (Level-1) RT 1 RT 2 RT 3 RT 4 Subject 1 Subject 2 Words (Level-2) “Boy” “Carbu retor”
  • 8. Crossed Random Effects • Random effects not hierarchically nested • Before: Each classroom appears in only 1 school • Here: Each item presented to each subject • If we draw all the lines in, we see they cross Subjects (Level-2) Trials (Level-1) RT 1 RT 2 RT 3 RT 4 Subject 1 Subject 2 Words (Level-2) “Boy” “Carbu retor”
  • 9. Crossed Random Effects • Crossed random effects structure • a/k/a cross-classified when we’re dealing with existing classifications Subjects (Level-2) Trials (Level-1) RT 1 RT 2 RT 3 RT 4 Subject 1 Subject 2 Words (Level-2) “Boy” “Carbu retor”
  • 10. Crossed Random Effects • Conceptually different sampling, but same syntax! • Let’s try fitting a model with: • A fixed effect of YearsOfStudy • Random intercepts for Subject and Word • model1 <- lmer(RT ~ 1 + YearsOfStudy + (1|Subject) + (1|Word), data=naming)
  • 11. Crossed Random Effects • Conceptually different sampling, but same syntax! • Let’s try fitting a model with: • A fixed effect of YearsOfStudy • Random intercepts for Subject and Word • model1 <- lmer(RT ~ 1 + YearsOfStudy + (1|Subject) + (1|Word), data=naming)
  • 12. Crossed Random Effects • model1 <- lmer(RT ~ 1 + YearsOfStudy + (1|Subject) + (1|Word), data=naming) Significant effect of YearsOfStudy – more study = faster responding
  • 13. Crossed Random Effects • Huge improvement over ANOVA analyses in psycholinguistics / experimental psychology! • We used to have to conduct separate analyses to assess generalizability over subjects & items • Or, item effects were simply ignored! Subjects (Level-2) Trials (Level-1) RT 1 RT 2 RT 3 RT 4 Subject 1 Subject 2 Words (Level-2) “Boy” “Carbu retor”
  • 14. Week 6.1: Crossed Random Effects ! Crossed Random Effects Analysis ! Example Design ! Joining Dataframes ! Random Slopes in Crossed Designs ! Between-Subjects & Within-Subjects Designs ! Between-Items & Within-Items Designs ! When are Random Slopes Necessary? ! Practice Activity
  • 15. Joining Dataframes • Let’s also look at the effect of word frequency • Problem: This is currently saved in a separate file (subtlexus.csv) • SUBTLEXUS norms for US English
  • 16. Joining Dataframes ! Sometimes different files/dataframes contain different variables relevant to the same observations ! Common scenario in mixed effects models context: Level-2 measurements are in a different file than Level-1 measurements naming.csv: 1 row per trial Each word appears in multiple rows subtlexus.csv: Each word has only one row with its frequency
  • 17. Joining Dataframes ! Sometimes different files/dataframes contain different variables relevant to the same observations ! Common scenario in mixed effects models context: Level-2 measurements are in a different file than Level-1 measurements 1 row per trial Each subject has multiple rows Each subject has only one row with their Working Memory score
  • 18. Joining Dataframes ! Sometimes different files/dataframes contain different variables relevant to the same observations ! Common scenario in mixed effects models context: Level-2 variables are in a different file than Level-1 measurements allschools: 1 row per student Each classroom appears in multiple rows tutoruse.csv: Each class has only one row—did this class use the tutor or not?
  • 19. ! “Look up word frequency from the other dataframe” ! We can combine these dataframes if they have at least one column in common ! Word tells us which word was presented on an individual trial, and it also identifies the word in our database of word frequency naming.csv: 1 row per trial Each word appears in multiple rows subtlexus.csv: Each word has only one row with its frequency Joining Dataframes
  • 20. Inner Join ! inner_join(naming, subtlexus, by='Word') -> naming2 ! New dataframe (naming2) has both the columns from naming (Subject, YearsOfStudy, RT) and the columns from subtlexus (WordFreq) ! Matches the observations using the Word column naming.csv: 1 row per trial Each word appears in multiple rows subtlexus.csv: Each word has only one row with its frequency
  • 21. Inner Join ! inner_join(naming, subtlexus, by='Word') -> naming2 ! New dataframe (naming2) has both the columns from naming (Subject, YearsOfStudy, RT) and the columns from subtlexus (WordFreq) ! Matches the observations using the Word column ! Like VLOOKUP in Excel
  • 22. Joins – Mismatching Column Names ! What if the columns have different names? ! Not true in this dataset—just a hypothetical ! Item in naming tells us which Word to look for in subtlexus … how can we tell R that? ! inner_join(naming, subtlexus, by=c('Item'='Word')) -> naming2 Name of the column in the dataframe we listed second Name of the column in the dataframe we listed first
  • 23. Other Types of Joins ! nrow(naming) ! nrow(naming2) ! Six words didn’t have a frequency measurement ! An inner join will drop rows that can’t be matched ! Alternative: ! naming2 <- left_join(naming, subtlexus, by='Word') Keep the rows in the first dataframe (naming) where we can’t find the matching WORD in the second dataframe (subtlexus) Can you guess what happens to WordFreq for those trials? 2940 2580
  • 24. Other Types of Joins ! nrow(naming) ! nrow(naming2) ! Six words didn’t have a frequency measurement ! An inner join will drop rows that can’t be matched ! Alternative: ! naming2 <- left_join(naming, subtlexus, by='Word') Keep the rows in the first dataframe (naming) where we can’t find the matching WORD in the second dataframe (subtlexus) WordFreq will be NA (missing data) in these rows 2940 2580
  • 25. Other Types of Joins ! nrow(naming) ! nrow(naming2) ! Six words didn’t have a frequency measurement ! An inner join will drop rows that can’t be matched ! A left or right join will keep every row in the first or second dataframe, respectively ! A full join keeps every row in both dataframes ! full_join(naming, subtlexus, by='Word') -> naming3 ! Includes rows for every word in the English word frequency database, even ones not used in our experiment. We DON’T need or want that in this case. 2940 2580
  • 26. Matching by Multiple Columns ! Sometimes, one column isn’t enough to uniquely match things across files/dataframes ! Can use multiple columns in join functions: ! inner_join(naming, subtlexus, by=c('Word', 'Country')) -> naming2 ! This is a logical AND. Has to match both Word and Country Imagine doing our task in both the US and UK. Word frequency differs somewhat between American English & British English, so now we need both Word and Country to look up the frequency.
  • 27. Crossed Random Effects • Now that we’ve added the word frequency to our dataframe, let’s add it to the model • model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1|Subject) + (1|Word), data=naming2) Greater Subject variance than Item variance. Typical in experiments because we often design items to be similar
  • 28. Week 6.1: Crossed Random Effects ! Crossed Random Effects Analysis ! Example Design ! Joining Dataframes ! Random Slopes in Crossed Designs ! Between-Subjects & Within-Subjects Designs ! Between-Items & Within-Items Designs ! When are Random Slopes Necessary? ! Practice Activity
  • 29. • What kind of random slopes might be relevant here? • To answer this question, we need to understand how “between-subjects variables” differ from “within-subjects variables” Between vs. Within Subjects
  • 30. Between vs. Within Subjects • In an experimental design, some variables are: " Between-Subjects variables: Each subject is in 1 and only 1 group … or has 1 and only 1 value • Randomly assigned to drug 1 vs. drug 2 vs. placebo • Demographic variables; e.g., SES • Cognitive/linguistic differences (e.g., working mem. score) • “Between subjects” because differences in this variable are only seen between one subject and another SUBJECT 10’s DATA Native speaker Trial 1: Correct Trial 2: Correct Trial 3: Incorrect SUBJECT 11’s DATA Non-native speaker Trial 1: Incorrect Trial 2: Correct Trial 3: Incorrect
  • 31. Between vs. Within Subjects • In an experimental design, some variables are: " Between-Subjects variables: Each subject is in 1 and only 1 group … or has 1 and only 1 value • Randomly assigned to drug 1 vs. drug 2 vs. placebo • Demographic variables; e.g., SES • Cognitive/linguistic differences (e.g., working mem. score) • “Between subjects” because differences in this variable are only seen between one subject and another " Within-Subjects variables: Same subject sees more than 1 condition or has >1 value • Same subject sees both congruent (green) and incongruent (blue) Stroop trials • Values that vary w/in a study, e.g., # of previous trials • Variables where you’d use a repeated measures ANOVA • “Within-subjects” because you can see differences in this variable even within a single subject
  • 32. Between vs. Within Subjects • In an experimental design, some variables are: " Between-Subjects variables: Each subject is in 1 and only 1 group … or has 1 and only 1 value • Randomly assigned to @ • Demographic variables; e.g., SES • Cognitive/linguistic differences (e.g., working mem. score) • “Between subjects” because differences in this variable are only seen between one subject and another " Within-Subjects variables: Same subject sees more than 1 condition or has >1 value • Same subject sees both congruent (green) and incongruent (blue) Stroop trials • Values that vary w/in a study, e.g., # of previous trials • Variables where you’d use a repeated measures ANOVA • “Within-subjects” because you can see differences in this variable even within a single subject SUBJECT 12’S DATA Trial 1: Congruent Stroop, 655 ms Trial 2: Incongruent Stroop, 512 ms Trial 3: Incongruent Stroop, 711 ms Trial 4: Congruent Stroop: 642 ms
  • 33. • The same variable could end up as between- or within-subjects, depending on experimental design • I’m interested in maintenance rehearsal (repetition) vs. elaborative rehearsal (relating to other concepts) • Half of my participants study second-language vocab using maintenance rehearsal, and half study words using elaborative rehearsal # Between Subjects • Each participant studies some words with maintenance rehearsal and some with elaborative rehearsal # Within Subjects Between vs. Within: Advanced
  • 34. • How about in our naming dataset? • Years of study is… • This experiment takes place at a single point in time, so the number of years a subject has been studying English is fixed and never varies • Between subjects • Word frequency is… • Each subject sees high-, medium- and low-frequency words • Within subjects Between vs. Within Subjects
  • 35. When are Random Slopes Appropriate? • If the random effect is subject… • Random slopes for subjects appropriate for: • Within-subjects variables • We can draw a regression line for each subject • Calculate the effect “within” each subject • Random slopes for subjects inappropriate for: • Between-subjects variables • Can’t draw a regression line within each subject Subject 1 High Frequency Subject 1 Low Frequency Subject 2 High Frequency Subject 2 Low Frequency Subject 1: 6 years of study Subject 2: 2 years of study
  • 36. Random Slopes: Implementation • Remember, previous model was: • model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1|Subject) + (1|Word), data=naming2) • What variable varies within subjects? Try adding a random slope for it • model3 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + ???????????????? + (1|Word), data=naming2)
  • 37. Random Slopes: Implementation • Remember, previous model was: • model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1|Subject) + (1|Word), data=naming2) • What variable varies within subjects? Try adding a random slope for it • model3 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1+WordFreq|Subject) + (1|Word), data=naming2) Again, miniature model formula for things we think will vary by subjects Subjects differ in their intercept (baseline RT) Subjects differ in the effect of word frequency on their RTs
  • 38. Random Slopes: Implementation • Remember, previous model was: • model2 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1|Subject) + (1|Word), data=naming2) • What variable varies within subjects? Try adding a random slope for it • model3 <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1+WordFreq|Subject) + (1|Word), data=naming2)
  • 39. Random Slopes • Original model says that subjects vary in baseline RT • Random intercept • And that a 1-unit change in word frequency ≈ 120 ms decrease in RT • Fixed effect across subjects 1 2 3 500 600 700 800 900 1000 1100 1200 Word frequency RT Subject 1 1 2 3 500 600 700 800 900 1000 1100 1200 Subject 2 1 2 3 500 600 700 800 900 1000 1100 1200 Subject 3 1 2 3 500 600 700 800 900 1000 1100 1200 Subject 4 Different intercepts for each subject Slope is the same for everyone
  • 40. Random Slopes • Original model says that subjects vary in baseline RT • Random intercept • And that a 1-unit change in word frequency ≈ 120 ms decrease in RT • Fixed effect across subjects • Differences in slope capture how individual people vary in sensitivity to word frequency • Random slope • Such differences may correlate with baseline 1 2 3 500 600 700 800 900 1000 1100 1200 Word frequency RT Subject 1 1 2 3 500 600 700 800 900 1000 1100 1200 Subject 2 1 2 3 500 600 700 800 900 1000 1100 1200 Subject 3 1 2 3 500 600 700 800 900 1000 1100 1200 Subject 4 Subjects still vary in intercept Slopes now also differ across sampled subjects Subjects with higher baselines also have steeper slopes
  • 41. Week 6.1: Crossed Random Effects ! Crossed Random Effects Analysis ! Example Design ! Joining Dataframes ! Random Slopes in Crossed Designs ! Between-Subjects & Within-Subjects Designs ! Between-Items & Within-Items Designs ! When are Random Slopes Necessary? ! Practice Activity
  • 42. Between vs. Within Items • We can draw a similar distinction between " Between-Items variables: Each item appears in 1 and only 1 condition … or has 1 and only 1 value • Visual complexity of pictures • One set of sentences is used in our “plausible” condition and a completely different set is used in our “implausible” condition • “Between items” because differences in this variable are only seen between one item and another " Within-Items variables: Same item appears in more than 1 condition or has >1 value • Same science facts presented (across subjects) in either an elaborative- or maintenance-rehearsal condition • We manipulate the same fictitious resume to have either a stereotypically African-American or European-American name
  • 43. Between vs. Within Items • Try updating the most recent model with random slope(s) for the within-items variable(s) • Hint: Think about whether each variable is constant for a particular Word or not • The final full model: • model.Full <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1 + WordFreq|Subject) + ?????????????? , data=naming2)
  • 44. Between vs. Within Items • Try updating the most recent model with random slope(s) for the within-items variable(s) • Hint: Think about whether each variable is constant for a particular Word or not • The final full model: • model.Full <- lmer(RT ~ 1 + YearsOfStudy * WordFreq + (1 + WordFreq|Subject) + (1 + YearsOfStudy|Word), data=naming2)
  • 45. Between vs. Within Items • Why didn’t we include a random slope of WordFreq by items? • Each word has a constant frequency (within this experiment) • Doesn’t make sense to discuss effect of word frequency within an item • No random slope of frequency by items • But, each item IS presented to different subjects who differ in their YearsOfStudy 1 2 3 4 300 400 500 600 700 Word frequency RT computer 1 2 3 4 300 400 500 600 700 panther 1 2 3 4 300 400 500 600 700 verify 1 2 3 4 300 400 500 600 700 memorandum
  • 46. Week 6.1: Crossed Random Effects ! Crossed Random Effects Analysis ! Example Design ! Joining Dataframes ! Random Slopes in Crossed Designs ! Between-Subjects & Within-Subjects Designs ! Between-Items & Within-Items Designs ! When are Random Slopes Necessary? ! Practice Activity
  • 47. When Are Random Slopes Necessary? • Remember that failing to account for clustering could inflate our Type I error rate • With factorial experiments, standard is to at least try to include all random slopes we can (Barr et al., 2013) • Maximal random effects structure • Expectation is that we assume that subjects could vary in, say, their WordFreq effect—that’s why we ran more than one subject • If this does not converge, simplify using strategies we discussed last class (e.g., removing correlation parameters)
  • 48. When Are Random Slopes Necessary? • Remember that failing to account for clustering could inflate our Type I error rate • In more observational data, not necessarily the case you’d include all possible random slopes • What’s theoretically relevant or expected?
  • 49. The View Ahead • We’ve covered the basics of fitting a mixed effects model • You will practice this in Wednesday’s lab • But, we have only used continuous variables • Next 3 weeks: Categorical variables (factors) • Next two weeks: Categorical predictors (IVs) • e.g., experimental vs. control condition; race/ethnicity • After that: Categorical outcomes (DVs) • e.g., recalled vs. didn’t recall a science fact; did or didn’t graduate high school
  • 50. Week 6.1: Crossed Random Effects ! Crossed Random Effects Analysis ! Example Design ! Joining Dataframes ! Random Slopes in Crossed Designs ! Between-Subjects & Within-Subjects Designs ! Between-Items & Within-Items Designs ! When are Random Slopes Necessary? ! Practice Activity