SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Course Business
• New R package to install: misty
• On Canvas for this week:
• New dataset we’ll cover in lecture: numerosity
• Lab materials
• Follow-up on last Wednesday
• Thanks for working with change in schedule
• Apologies for not having a larger lab available
Week 7.1: Centering & Transformations
! Centering
! Today’s Dataset
! Mean Centering
! Centering Around Other Values
! Logarithmic Transformation
! Grand-Mean vs. Cluster-Mean Centering
! Lab
Today’s Dataset
• Brain warmup – count the number of dots
5
10
12
13
Today’s Dataset
• numerosity.csv: Looking at relation of math
anxiety to basic number skills
• Participants log in once a day on their smartphone
to complete a dot-counting task
• And, rate their math anxiety each time
• 30 trials (one per day for a month)
• Measures:
• RT for each trial
• NumDots in each display
• Math Anxiety on a scale of 1 to 7
Week 7.1: Centering & Transformations
! Centering
! Today’s Dataset
! Mean Centering
! Centering Around Other Values
! Logarithmic Transformation
! Grand-Mean vs. Cluster-Mean Centering
! Lab
Interpreting Intercepts
• Let’s start with examining the effect of numerosity
(NumDots) on RT in the dot-counting task
• At this stage, we don’t care about Anxiety
• Common that spreadsheet contains extra, irrelevant columns
• What would the maximal model for this be?
• dotModel.Maximal <- lmer(RT ~
1 + NumDots +
(1 + NumDots|Subject) +
data = numerosity)
• Hint #1: NumDots is a within-subjects variable
• Hint #2: Could there be a different effect of NumDots for each
subject?
SUBJECT RANDOM EFFECTS
Interpreting Intercepts
• Let’s start with examining the effect of numerosity
(NumDots) on RT in the dot-counting task
• At this stage, we don’t care about Anxiety
• Common that spreadsheet contains extra, irrelevant columns
• What would the maximal model for this be?
• dotModel.Maximal <- lmer(RT ~
1 + NumDots +
(1 + NumDots|Subject) +
data = numerosity)
• Numerosity is manipulated within subjects (each subject
sees several different display sizes)
• Possible to calculate each subject’s personal NumDots effect
(slope)—some subjects could count faster than othes
• Include random slope
Interpreting Intercepts
• Let’s start with examining the effect of numerosity
(NumDots) on RT in the dot-counting task
• At this stage, we don’t care about Anxiety
• Common that spreadsheet contains extra, irrelevant columns
• Results:
• Intercept: RT is 1690 ms when number of dots is 0
• NumDots effect: +9.4 ms for each dot
• But, display size of 0 is impossible. Odd to talk about.
y = 1690 + 9.4 * NumDots
Interpreting Intercepts
• Let’s change the model so that 0 means something
Intercept: 1690 ms
RT = 1690 ms +
8 * NumDots
Mean Centering
• Mean number of dots is ~67
• Imagine we subtracted this mean size
from each display size
• New zero represents mean display size
• “Mean centering”
ORIGINAL MEAN SUBTRACTED
102
67
58
35
0
-9
Mean Centering
• New zero represents mean display size
• “Mean centering”
Centering—How to Do It
• First, create a new variable:
• library(misty)
• numerosity %>%
mutate(NumDots.cen = center(NumDots))
-> numerosity
• Then, use the new variable in your model
• dotModel.cen.Maximal <- lmer(RT ~
1 + NumDots.cen +
(1 + NumDots.cen|Subject) +
data = numerosity)
• Old: New:
• What hasn’t changed?
• NumDots effect is still ~9.4 per dot
• What has changed?
• Intercept is 2323 ms at mean numerosity
• Correlation of NumDots effect with intercept is now
almost 0. Indicates that we centered correctly.
• New model: y = 2323 + 9.4 * NumDots
Centering—Results
Centering—Results
• Intercept: RT is 2094 ms at mean display size
• NumDots effect: +8 ms for each additional dot
Intercept: 2094 ms
RT = 2094 ms +
8 * NumDots
Which Do You Like Better?
UNCENTERED
CENTERED
• Good if zero is meaningful
• Years of study abroad, number
of previous trials, number of
missed classes…
• Good if zero is not meaningful or
not observed
• Reduced correlation w/ intercept
also helps with convergence (esp.
in binomial models)
Which Do You Like Better?
• Both regression equations apply
only to plausible number of dots
• With raw number of dots, can’t have
a numerosity of 0 or less
• With centered number of dots, can’t
have a value of -67 or less (0 minus
the mean of 67)
Week 7.1: Centering & Transformations
! Centering
! Today’s Dataset
! Mean Centering
! Centering Around Other Values
! Logarithmic Transformation
! Grand-Mean vs. Cluster-Mean Centering
! Lab
Centering Around Other Values
• We could also make 0 correspond to some
other sensible/useful value
• The smallest logically possible value
• numerosity %>%
mutate(NumDots2 = center(NumDots, value=1))
-> numerosity
• The smallest observed value in our data
• numerosity %>%
mutate(NumDots3 = center(NumDots,
value=min(NumDots)) -> numerosity
Week 7.1: Centering & Transformations
! Centering
! Today’s Dataset
! Mean Centering
! Centering Around Other Values
! Logarithmic Transformation
! Grand-Mean vs. Cluster-Mean Centering
! Lab
Logarithmic Transformations
• Let’s look more closely at the relation between
dots and RT…
• Not totally linear…
Logarithmic Transformations
• Let’s look more closely at the relation between
dots and RT…
• Not totally linear…
Most points below the
line at small x values
Most points above the
line at larger x values
Logarithmic Transformations
• Let’s look more closely at the relation between
dots and RT…
• Not totally linear…
• Effect “levels off”
• Effect of adding 1
more dot is smaller
when there are
already a lot of
dots
• “Diminishing
returns”
Logarithmic Transformations
Fechner’s law
Logarithmic Transformations
• This type of non-linear relationship is well
modeled by a logarithmic transformation
• numerosity %>%
mutate(NumDots.log = log(NumDots)) ->
numerosity
Logarithmic Transformations
• This looks more linear
• How can we compare the fit of these models?
• Hint: We subtracted NumDots and added
NumDots.log, so these are not nested models
OLD NEW
Logarithmic Transformations
• This looks more linear
• How can we compare the fit of these models?
• Hint: We subtracted NumDots and added
NumDots.log, so these are not nested models
• anova(dotModel.Maximal, dotModel.log.Maximal)
Model with log(NumDos) has lower (better)
AIC and BIC
Logarithmic Transformations
• Logarithmic relationships pervasive
• Many aspects of perception
(Fechner and Weber laws)
• Many aspects of experience
• Dose-response
• Income
Logarithmic Transformations
• Logarithmic relationships pervasive
• Many aspects of perception
(Fechner and Weber laws)
• Many aspects of experience
• Dose-response
• Income
• If you want to center, apply the log transform
first, then center
• Otherwise, the final variable will not be centered
• Idea is that the “true” variable has a log scale, so we
want to center around that mean
Logarithmic Transformations
• When to apply a transformation?
• We have an a priori reason to expect a logarithmic
(or other) relationship
• e.g., some well-studied variable, like loudness or word
frequency
• Empirically based on the observed relationship to
the DV
• But beware of overfitting!
Week 7.1: Centering & Transformations
! Centering
! Today’s Dataset
! Mean Centering
! Centering Around Other Values
! Logarithmic Transformation
! Grand-Mean vs. Cluster-Mean Centering
! Lab
• Let’s turn to the effects of math anxiety
• Remember that people provided a different Anxiety
rating on each of the 30 days (trials)
• Is this a level-1 or level-2 variable?
Grand-Mean vs. Cluster-Mean Centering
Day
1
Day
2
Day
3
Day
4
Subject
1
Subject
2
Subjects (Level-2)
Trials (Level-1)
• What mean to use to center a level-1 variable?
• Grand mean?: 2.23
Grand-Mean vs. Cluster-Mean Centering
• What mean to use to center a level-1 variable?
• Grand mean?: 2.23
• But individual subject means differ a lot…
• Subject 1: 1.97, Subject 11: 5.03, Subject 2: 4.03
Grand-Mean vs. Cluster-Mean Centering
• Both sources of variation may be relevant
• Grand-mean centering: Are you more or less math-
anxious compared to the average person (2.23)?
• Trait anxiety
• Cluster-mean centering: Are you more or less
math-anxious on this day compared to your average
(for subject 2: 4.03)?
• State anxiety
Grand-Mean vs. Cluster-Mean Centering
• Centering a level-1 variable “smushes” together
these two sources of variance (Hoffman, 2015, 2019)
• How the cluster differs from the grand mean
• How the observation differs from the cluster mean
• A better approach is to track these two
influences separately
• numerosity %>% mutate(TraitAnxiety =
center(Anxiety, type='CGM', group=Subject))
-> numerosity
• Center around the grand mean (a level-2 variable)
• numerosity %>% mutate(StateAnxiety =
center(Anxiety, type='CWC', group=Subject))
-> numerosity
• Center around the cluster mean (a level-1 variable)
Grand-Mean vs. Cluster-Mean Centering
• Then, include both of these in the model
• model.Anxiety <- lmer(RT ~ 1 + TraitAnxiety +
StateAnxiety + (1|Subject), data=numerosity)
• model.Anxiety %>% summary()
• Can also include a random slope for the level-1
variable (StateAnxiety)
Grand-Mean vs. Cluster-Mean Centering
• Possible to have one effect, but not the other
• Trait effect but not a state effect
• Could reflect another individual difference (math skill?)
Grand-Mean vs. Cluster-Mean Centering
People with
more trait
anxiety have
longer RTs
Within a
person, state
anxiety does
not predict RT
• Possible to have one effect, but not the other
• Trait effect but not a state effect
• Could reflect another individual difference (math skill?)
• State effect but not a trait effect
• What matters is where you are relative to your norms
Grand-Mean vs. Cluster-Mean Centering
Location of the
person mean
does not
matter
Correlation
within a
person
• Possible to have one effect, but not the other
• Trait effect but not a state effect
• Could reflect another individual difference (math skill?)
• State effect but not a trait effect
• What matters is where you are relative to your norms
• Or both!
Grand-Mean vs. Cluster-Mean Centering
Correlation
within a
person
People with
more trait
anxiety have
longer RTs
• Conclusions:
• For level-1 variables, want to consider both
between- and within- cluster ariation
• This does not matter:
• For level-2 variables (e.g., no within-person slope for IQ or
math class GPA)
• No within-cluster variance
• Every cluster has the same mean (e.g., experimental
manipulation like NumDots)
• No between-cluster variance
Grand-Mean vs. Cluster-Mean Centering
Week 7.1: Centering & Transformations
! Centering
! Today’s Dataset
! Mean Centering
! Centering Around Other Values
! Logarithmic Transformation
! Grand-Mean vs. Cluster-Mean Centering
! Lab

Weitere ähnliche Inhalte

Was ist angesagt?

Mixed Effects Models - Fixed Effects
Mixed Effects Models - Fixed EffectsMixed Effects Models - Fixed Effects
Mixed Effects Models - Fixed EffectsScott Fraundorf
 
Mixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingMixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingScott Fraundorf
 
Mixed Effects Models - Post-Hoc Comparisons
Mixed Effects Models - Post-Hoc ComparisonsMixed Effects Models - Post-Hoc Comparisons
Mixed Effects Models - Post-Hoc ComparisonsScott 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 - Model Comparison
Mixed Effects Models - Model ComparisonMixed Effects Models - Model Comparison
Mixed Effects Models - Model ComparisonScott 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 - Autocorrelation
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationScott Fraundorf
 
Basics of Structural Equation Modeling
Basics of Structural Equation ModelingBasics of Structural Equation Modeling
Basics of Structural Equation Modelingsmackinnon
 
Reporting kendall's tau in apa (1)
Reporting kendall's tau in apa (1)Reporting kendall's tau in apa (1)
Reporting kendall's tau in apa (1)Ken Plummer
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionRupak Roy
 
Autocorrelation
AutocorrelationAutocorrelation
AutocorrelationADITHYAT1
 
Multinomial Logistic Regression Analysis
Multinomial Logistic Regression AnalysisMultinomial Logistic Regression Analysis
Multinomial Logistic Regression AnalysisHARISH Kumar H R
 
Multiple Regression and Logistic Regression
Multiple Regression and Logistic RegressionMultiple Regression and Logistic Regression
Multiple Regression and Logistic RegressionKaushik Rajan
 
Linear models for data science
Linear models for data scienceLinear models for data science
Linear models for data scienceBrad Klingenberg
 

Was ist angesagt? (20)

Mixed Effects Models - Fixed Effects
Mixed Effects Models - Fixed EffectsMixed Effects Models - Fixed Effects
Mixed Effects Models - Fixed Effects
 
Mixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingMixed Effects Models - Data Processing
Mixed Effects Models - Data Processing
 
Mixed Effects Models - Post-Hoc Comparisons
Mixed Effects Models - Post-Hoc ComparisonsMixed Effects Models - Post-Hoc Comparisons
Mixed Effects Models - Post-Hoc Comparisons
 
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 - Model Comparison
Mixed Effects Models - Model ComparisonMixed Effects Models - Model Comparison
Mixed Effects Models - Model Comparison
 
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 - Autocorrelation
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - Autocorrelation
 
Basics of Structural Equation Modeling
Basics of Structural Equation ModelingBasics of Structural Equation Modeling
Basics of Structural Equation Modeling
 
Reporting kendall's tau in apa (1)
Reporting kendall's tau in apa (1)Reporting kendall's tau in apa (1)
Reporting kendall's tau in apa (1)
 
Key ideas, terms and concepts in SEM
Key ideas, terms and concepts in SEMKey ideas, terms and concepts in SEM
Key ideas, terms and concepts in SEM
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
spss teaching
spss teachingspss teaching
spss teaching
 
Stat topics
Stat topicsStat topics
Stat topics
 
Autocorrelation
AutocorrelationAutocorrelation
Autocorrelation
 
Curs 3
Curs 3Curs 3
Curs 3
 
Double Hurdle Models
Double Hurdle ModelsDouble Hurdle Models
Double Hurdle Models
 
Multinomial Logistic Regression Analysis
Multinomial Logistic Regression AnalysisMultinomial Logistic Regression Analysis
Multinomial Logistic Regression Analysis
 
Multiple Regression and Logistic Regression
Multiple Regression and Logistic RegressionMultiple Regression and Logistic Regression
Multiple Regression and Logistic Regression
 
Linear models for data science
Linear models for data scienceLinear models for data science
Linear models for data science
 
Regression
RegressionRegression
Regression
 

Ähnlich wie Mixed Effects Models - Centering and Transformations

Topic 5 (multiple regression)
Topic 5 (multiple regression)Topic 5 (multiple regression)
Topic 5 (multiple regression)Ryan Herzog
 
Topic 5 (multiple regression)
Topic 5 (multiple regression)Topic 5 (multiple regression)
Topic 5 (multiple regression)Ryan Herzog
 
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...Maninda Edirisooriya
 
3. Statistical Analysis.pptx
3. Statistical Analysis.pptx3. Statistical Analysis.pptx
3. Statistical Analysis.pptxjeyanthisivakumar
 
probability.pptx
probability.pptxprobability.pptx
probability.pptxbisan3
 
Learning to Learn by Gradient Descent by Gradient Descent
Learning to Learn by Gradient Descent by Gradient DescentLearning to Learn by Gradient Descent by Gradient Descent
Learning to Learn by Gradient Descent by Gradient DescentKaty Lee
 
01 introduction stat
01 introduction stat01 introduction stat
01 introduction statantaraar2009
 
Measure of Variability Report.pptx
Measure of Variability Report.pptxMeasure of Variability Report.pptx
Measure of Variability Report.pptxCalvinAdorDionisio
 
Lect 3 background mathematics
Lect 3 background mathematicsLect 3 background mathematics
Lect 3 background mathematicshktripathy
 
Lect 3 background mathematics for Data Mining
Lect 3 background mathematics for Data MiningLect 3 background mathematics for Data Mining
Lect 3 background mathematics for Data Mininghktripathy
 
Foundations of Machine Learning - StampedeCon AI Summit 2017
Foundations of Machine Learning - StampedeCon AI Summit 2017Foundations of Machine Learning - StampedeCon AI Summit 2017
Foundations of Machine Learning - StampedeCon AI Summit 2017StampedeCon
 

Ähnlich wie Mixed Effects Models - Centering and Transformations (20)

Topic 5 (multiple regression)
Topic 5 (multiple regression)Topic 5 (multiple regression)
Topic 5 (multiple regression)
 
Topic 5 (multiple regression)
Topic 5 (multiple regression)Topic 5 (multiple regression)
Topic 5 (multiple regression)
 
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
 
3. Statistical Analysis.pptx
3. Statistical Analysis.pptx3. Statistical Analysis.pptx
3. Statistical Analysis.pptx
 
5954987.ppt
5954987.ppt5954987.ppt
5954987.ppt
 
Scaling and Normalization
Scaling and NormalizationScaling and Normalization
Scaling and Normalization
 
probability.pptx
probability.pptxprobability.pptx
probability.pptx
 
Learning to Learn by Gradient Descent by Gradient Descent
Learning to Learn by Gradient Descent by Gradient DescentLearning to Learn by Gradient Descent by Gradient Descent
Learning to Learn by Gradient Descent by Gradient Descent
 
Regression ppt
Regression pptRegression ppt
Regression ppt
 
PCA.pptx
PCA.pptxPCA.pptx
PCA.pptx
 
Unit 2 - Statistics
Unit 2 - StatisticsUnit 2 - Statistics
Unit 2 - Statistics
 
01 introduction stat
01 introduction stat01 introduction stat
01 introduction stat
 
1015 track2 abbott
1015 track2 abbott1015 track2 abbott
1015 track2 abbott
 
1030 track2 abbott
1030 track2 abbott1030 track2 abbott
1030 track2 abbott
 
Measure of Variability Report.pptx
Measure of Variability Report.pptxMeasure of Variability Report.pptx
Measure of Variability Report.pptx
 
SQLDay2013_MarcinSzeliga_DataInDataMining
SQLDay2013_MarcinSzeliga_DataInDataMiningSQLDay2013_MarcinSzeliga_DataInDataMining
SQLDay2013_MarcinSzeliga_DataInDataMining
 
15303589.ppt
15303589.ppt15303589.ppt
15303589.ppt
 
Lect 3 background mathematics
Lect 3 background mathematicsLect 3 background mathematics
Lect 3 background mathematics
 
Lect 3 background mathematics for Data Mining
Lect 3 background mathematics for Data MiningLect 3 background mathematics for Data Mining
Lect 3 background mathematics for Data Mining
 
Foundations of Machine Learning - StampedeCon AI Summit 2017
Foundations of Machine Learning - StampedeCon AI Summit 2017Foundations of Machine Learning - StampedeCon AI Summit 2017
Foundations of Machine Learning - StampedeCon AI Summit 2017
 

Mehr von Scott Fraundorf

Mixed Effects Models - Power
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - PowerScott Fraundorf
 
Mixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeScott Fraundorf
 
Mixed Effects Models - Missing Data
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing DataScott Fraundorf
 
Mixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsScott Fraundorf
 
Mixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 VariablesMixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 VariablesScott Fraundorf
 
Mixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsScott Fraundorf
 

Mehr von Scott Fraundorf (7)

Mixed Effects Models - Power
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - Power
 
Mixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect Size
 
Mixed Effects Models - Missing Data
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing Data
 
Mixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit Models
 
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
 
Scott_Fraundorf_Resume
Scott_Fraundorf_ResumeScott_Fraundorf_Resume
Scott_Fraundorf_Resume
 

Kürzlich hochgeladen

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 

Kürzlich hochgeladen (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

Mixed Effects Models - Centering and Transformations

  • 1. Course Business • New R package to install: misty • On Canvas for this week: • New dataset we’ll cover in lecture: numerosity • Lab materials • Follow-up on last Wednesday • Thanks for working with change in schedule • Apologies for not having a larger lab available
  • 2. Week 7.1: Centering & Transformations ! Centering ! Today’s Dataset ! Mean Centering ! Centering Around Other Values ! Logarithmic Transformation ! Grand-Mean vs. Cluster-Mean Centering ! Lab
  • 3. Today’s Dataset • Brain warmup – count the number of dots
  • 4. 5
  • 5. 10
  • 6. 12
  • 7. 13
  • 8. Today’s Dataset • numerosity.csv: Looking at relation of math anxiety to basic number skills • Participants log in once a day on their smartphone to complete a dot-counting task • And, rate their math anxiety each time • 30 trials (one per day for a month) • Measures: • RT for each trial • NumDots in each display • Math Anxiety on a scale of 1 to 7
  • 9. Week 7.1: Centering & Transformations ! Centering ! Today’s Dataset ! Mean Centering ! Centering Around Other Values ! Logarithmic Transformation ! Grand-Mean vs. Cluster-Mean Centering ! Lab
  • 10. Interpreting Intercepts • Let’s start with examining the effect of numerosity (NumDots) on RT in the dot-counting task • At this stage, we don’t care about Anxiety • Common that spreadsheet contains extra, irrelevant columns • What would the maximal model for this be? • dotModel.Maximal <- lmer(RT ~ 1 + NumDots + (1 + NumDots|Subject) + data = numerosity) • Hint #1: NumDots is a within-subjects variable • Hint #2: Could there be a different effect of NumDots for each subject? SUBJECT RANDOM EFFECTS
  • 11. Interpreting Intercepts • Let’s start with examining the effect of numerosity (NumDots) on RT in the dot-counting task • At this stage, we don’t care about Anxiety • Common that spreadsheet contains extra, irrelevant columns • What would the maximal model for this be? • dotModel.Maximal <- lmer(RT ~ 1 + NumDots + (1 + NumDots|Subject) + data = numerosity) • Numerosity is manipulated within subjects (each subject sees several different display sizes) • Possible to calculate each subject’s personal NumDots effect (slope)—some subjects could count faster than othes • Include random slope
  • 12. Interpreting Intercepts • Let’s start with examining the effect of numerosity (NumDots) on RT in the dot-counting task • At this stage, we don’t care about Anxiety • Common that spreadsheet contains extra, irrelevant columns • Results: • Intercept: RT is 1690 ms when number of dots is 0 • NumDots effect: +9.4 ms for each dot • But, display size of 0 is impossible. Odd to talk about. y = 1690 + 9.4 * NumDots
  • 13. Interpreting Intercepts • Let’s change the model so that 0 means something Intercept: 1690 ms RT = 1690 ms + 8 * NumDots
  • 14. Mean Centering • Mean number of dots is ~67 • Imagine we subtracted this mean size from each display size • New zero represents mean display size • “Mean centering” ORIGINAL MEAN SUBTRACTED 102 67 58 35 0 -9
  • 15. Mean Centering • New zero represents mean display size • “Mean centering”
  • 16. Centering—How to Do It • First, create a new variable: • library(misty) • numerosity %>% mutate(NumDots.cen = center(NumDots)) -> numerosity • Then, use the new variable in your model • dotModel.cen.Maximal <- lmer(RT ~ 1 + NumDots.cen + (1 + NumDots.cen|Subject) + data = numerosity)
  • 17. • Old: New: • What hasn’t changed? • NumDots effect is still ~9.4 per dot • What has changed? • Intercept is 2323 ms at mean numerosity • Correlation of NumDots effect with intercept is now almost 0. Indicates that we centered correctly. • New model: y = 2323 + 9.4 * NumDots Centering—Results
  • 18. Centering—Results • Intercept: RT is 2094 ms at mean display size • NumDots effect: +8 ms for each additional dot Intercept: 2094 ms RT = 2094 ms + 8 * NumDots
  • 19. Which Do You Like Better? UNCENTERED CENTERED • Good if zero is meaningful • Years of study abroad, number of previous trials, number of missed classes… • Good if zero is not meaningful or not observed • Reduced correlation w/ intercept also helps with convergence (esp. in binomial models)
  • 20. Which Do You Like Better? • Both regression equations apply only to plausible number of dots • With raw number of dots, can’t have a numerosity of 0 or less • With centered number of dots, can’t have a value of -67 or less (0 minus the mean of 67)
  • 21. Week 7.1: Centering & Transformations ! Centering ! Today’s Dataset ! Mean Centering ! Centering Around Other Values ! Logarithmic Transformation ! Grand-Mean vs. Cluster-Mean Centering ! Lab
  • 22. Centering Around Other Values • We could also make 0 correspond to some other sensible/useful value • The smallest logically possible value • numerosity %>% mutate(NumDots2 = center(NumDots, value=1)) -> numerosity • The smallest observed value in our data • numerosity %>% mutate(NumDots3 = center(NumDots, value=min(NumDots)) -> numerosity
  • 23. Week 7.1: Centering & Transformations ! Centering ! Today’s Dataset ! Mean Centering ! Centering Around Other Values ! Logarithmic Transformation ! Grand-Mean vs. Cluster-Mean Centering ! Lab
  • 24. Logarithmic Transformations • Let’s look more closely at the relation between dots and RT… • Not totally linear…
  • 25. Logarithmic Transformations • Let’s look more closely at the relation between dots and RT… • Not totally linear… Most points below the line at small x values Most points above the line at larger x values
  • 26. Logarithmic Transformations • Let’s look more closely at the relation between dots and RT… • Not totally linear… • Effect “levels off” • Effect of adding 1 more dot is smaller when there are already a lot of dots • “Diminishing returns”
  • 28. Logarithmic Transformations • This type of non-linear relationship is well modeled by a logarithmic transformation • numerosity %>% mutate(NumDots.log = log(NumDots)) -> numerosity
  • 29. Logarithmic Transformations • This looks more linear • How can we compare the fit of these models? • Hint: We subtracted NumDots and added NumDots.log, so these are not nested models OLD NEW
  • 30. Logarithmic Transformations • This looks more linear • How can we compare the fit of these models? • Hint: We subtracted NumDots and added NumDots.log, so these are not nested models • anova(dotModel.Maximal, dotModel.log.Maximal) Model with log(NumDos) has lower (better) AIC and BIC
  • 31. Logarithmic Transformations • Logarithmic relationships pervasive • Many aspects of perception (Fechner and Weber laws) • Many aspects of experience • Dose-response • Income
  • 32. Logarithmic Transformations • Logarithmic relationships pervasive • Many aspects of perception (Fechner and Weber laws) • Many aspects of experience • Dose-response • Income • If you want to center, apply the log transform first, then center • Otherwise, the final variable will not be centered • Idea is that the “true” variable has a log scale, so we want to center around that mean
  • 33. Logarithmic Transformations • When to apply a transformation? • We have an a priori reason to expect a logarithmic (or other) relationship • e.g., some well-studied variable, like loudness or word frequency • Empirically based on the observed relationship to the DV • But beware of overfitting!
  • 34. Week 7.1: Centering & Transformations ! Centering ! Today’s Dataset ! Mean Centering ! Centering Around Other Values ! Logarithmic Transformation ! Grand-Mean vs. Cluster-Mean Centering ! Lab
  • 35. • Let’s turn to the effects of math anxiety • Remember that people provided a different Anxiety rating on each of the 30 days (trials) • Is this a level-1 or level-2 variable? Grand-Mean vs. Cluster-Mean Centering Day 1 Day 2 Day 3 Day 4 Subject 1 Subject 2 Subjects (Level-2) Trials (Level-1)
  • 36. • What mean to use to center a level-1 variable? • Grand mean?: 2.23 Grand-Mean vs. Cluster-Mean Centering
  • 37. • What mean to use to center a level-1 variable? • Grand mean?: 2.23 • But individual subject means differ a lot… • Subject 1: 1.97, Subject 11: 5.03, Subject 2: 4.03 Grand-Mean vs. Cluster-Mean Centering
  • 38. • Both sources of variation may be relevant • Grand-mean centering: Are you more or less math- anxious compared to the average person (2.23)? • Trait anxiety • Cluster-mean centering: Are you more or less math-anxious on this day compared to your average (for subject 2: 4.03)? • State anxiety Grand-Mean vs. Cluster-Mean Centering
  • 39. • Centering a level-1 variable “smushes” together these two sources of variance (Hoffman, 2015, 2019) • How the cluster differs from the grand mean • How the observation differs from the cluster mean • A better approach is to track these two influences separately • numerosity %>% mutate(TraitAnxiety = center(Anxiety, type='CGM', group=Subject)) -> numerosity • Center around the grand mean (a level-2 variable) • numerosity %>% mutate(StateAnxiety = center(Anxiety, type='CWC', group=Subject)) -> numerosity • Center around the cluster mean (a level-1 variable) Grand-Mean vs. Cluster-Mean Centering
  • 40. • Then, include both of these in the model • model.Anxiety <- lmer(RT ~ 1 + TraitAnxiety + StateAnxiety + (1|Subject), data=numerosity) • model.Anxiety %>% summary() • Can also include a random slope for the level-1 variable (StateAnxiety) Grand-Mean vs. Cluster-Mean Centering
  • 41. • Possible to have one effect, but not the other • Trait effect but not a state effect • Could reflect another individual difference (math skill?) Grand-Mean vs. Cluster-Mean Centering People with more trait anxiety have longer RTs Within a person, state anxiety does not predict RT
  • 42. • Possible to have one effect, but not the other • Trait effect but not a state effect • Could reflect another individual difference (math skill?) • State effect but not a trait effect • What matters is where you are relative to your norms Grand-Mean vs. Cluster-Mean Centering Location of the person mean does not matter Correlation within a person
  • 43. • Possible to have one effect, but not the other • Trait effect but not a state effect • Could reflect another individual difference (math skill?) • State effect but not a trait effect • What matters is where you are relative to your norms • Or both! Grand-Mean vs. Cluster-Mean Centering Correlation within a person People with more trait anxiety have longer RTs
  • 44. • Conclusions: • For level-1 variables, want to consider both between- and within- cluster ariation • This does not matter: • For level-2 variables (e.g., no within-person slope for IQ or math class GPA) • No within-cluster variance • Every cluster has the same mean (e.g., experimental manipulation like NumDots) • No between-cluster variance Grand-Mean vs. Cluster-Mean Centering
  • 45. Week 7.1: Centering & Transformations ! Centering ! Today’s Dataset ! Mean Centering ! Centering Around Other Values ! Logarithmic Transformation ! Grand-Mean vs. Cluster-Mean Centering ! Lab