analysis of covariance david markham [email protected]

22
Analysis of Analysis of Covariance Covariance David Markham David Markham [email protected] [email protected]

Upload: olivia-payne

Post on 28-Dec-2015

226 views

Category:

Documents


2 download

TRANSCRIPT

Analysis of CovarianceAnalysis of Covariance

David MarkhamDavid Markham

[email protected]@bsu.edu

Analysis of CovarianceAnalysis of Covariance

Analysis of Covariance (ANCOVA) is a Analysis of Covariance (ANCOVA) is a statistical test related to ANOVAstatistical test related to ANOVA

It tests whether there is a significant It tests whether there is a significant difference between groups after controlling difference between groups after controlling for variance explained by a covariatefor variance explained by a covariate

A covariate is a continuous variable that A covariate is a continuous variable that correlates with the dependent variablecorrelates with the dependent variable

So, what does all that mean?So, what does all that mean?

This means that you can, in effect, “partial This means that you can, in effect, “partial out” a continuous variable and run an out” a continuous variable and run an ANOVA on the resultsANOVA on the results

This is one way that you can run a This is one way that you can run a statistical test with both categorical and statistical test with both categorical and continuous independent variablescontinuous independent variables

Hypotheses for ANCOVAHypotheses for ANCOVA

HH00 and and HH11 need to be stated slightly need to be stated slightly

differently for an ANCOVA than a regular differently for an ANCOVA than a regular ANOVAANOVA

HH00: the group means are equal after : the group means are equal after

controlling for the covariatecontrolling for the covariate HH11: the group means are not equal after : the group means are not equal after

controlling for the covariatecontrolling for the covariate

Assumptions for ANCOVAAssumptions for ANCOVA

ANOVA assumptions:ANOVA assumptions: Variance is normally distributedVariance is normally distributed Variance is equal between groupsVariance is equal between groups All measurements are independentAll measurements are independentAlso, for ANCOVA:Also, for ANCOVA: Relationship between DV and covariate is Relationship between DV and covariate is

linearlinear The relationship between the DV and The relationship between the DV and

covariate is the same for all groupscovariate is the same for all groups

How does ANCOVA work?How does ANCOVA work?

ANCOVA works by adjusting the total SS, ANCOVA works by adjusting the total SS, group SS, and error SS of the independent group SS, and error SS of the independent variable to remove the influence of the variable to remove the influence of the covariatecovariate

However, the sums of squares must also However, the sums of squares must also be calculated for the covariate. For this be calculated for the covariate. For this reason, SSreason, SSdvdv will be used for SS scores for will be used for SS scores for the dependent variable, and SSthe dependent variable, and SScv cv will be will be used for the covariateused for the covariate

Sum of SquaresSum of Squares

groupSStotalSSerrorSS

xxerrorSS

xxngroupSS

xxtotalSS

xxx

jijx

jjx

ijx

2

2

2

)(

)(

)(

Sum of ProductsSum of Products

To control for the covariate, the sum of products To control for the covariate, the sum of products (SP) for the DV and covariate must also be (SP) for the DV and covariate must also be usedused

This is the sum of the products of the residuals This is the sum of the products of the residuals for both the DV and the covariatefor both the DV and the covariate

In the following slides, x is the covariate, and y In the following slides, x is the covariate, and y is the DV. i is the individual subject, and j is the is the DV. i is the individual subject, and j is the group.group.

Total Sum of ProductsTotal Sum of Products

))(( yyxxtotalSP ij

j i

ijxy This is just the sum of the multiplied residuals This is just the sum of the multiplied residuals

for all data points.for all data points.

Group Sum of ProductsGroup Sum of Products

)()( yyxxngroupSP j

j

jjxy This is the sum of the products of the group This is the sum of the products of the group

means minus the grand means times the group means minus the grand means times the group size.size.

Error Sum of ProductsError Sum of Products

groupSPtotalSPerrorSP

yyxxerrorSP

xyxyxy

jij

j i

jijxy

))((

This is the sum of the products of the DV and This is the sum of the products of the DV and residual minus the group means of the DV and residual minus the group means of the DV and residualresidual

This just happens to be the same as the difference This just happens to be the same as the difference between the other two sum of productsbetween the other two sum of products

Adjusting the Sum of SquaresAdjusting the Sum of Squares

Using the SS’s for the covariate and the Using the SS’s for the covariate and the DV, and the SP’s, we can adjust the SS’s DV, and the SP’s, we can adjust the SS’s for the DVfor the DV

Sum of SquaresSum of Squares

errorSS

errorSPerrorSSadjerrorSS

totalSS

totalSP

errorSS

errorSPgroupSSadjgroupSS

totalSS

totalSPtotalSSadjtotalSS

x

xyyy

x

xy

x

xyyy

x

xyyy

2

22

2

)(

Now what?Now what?

Using the adjusted SS’s, we can now run Using the adjusted SS’s, we can now run an ANOVA to see if there is a difference an ANOVA to see if there is a difference between groups.between groups.

This is the exact same as a regular This is the exact same as a regular ANOVA, but using the adjusted SS’s ANOVA, but using the adjusted SS’s instead of the original ones.instead of the original ones.

Degrees of freedom are not affectedDegrees of freedom are not affected

A few more thingsA few more things

We can also determine whether the We can also determine whether the covariate is significant by getting a F scorecovariate is significant by getting a F score

adjtotalSS

NtotalSS

totalSP

NFy

x

xy2

)(

)2,1(

2

A few more thingsA few more things

The group means can also be adjusted to The group means can also be adjusted to eliminate the effect of the covariateeliminate the effect of the covariate

xxerrorSS

errorSPyyadj j

x

xyjj

Post-hocs for ANCOVAPost-hocs for ANCOVA

Post-hoc tests can be done using the Post-hoc tests can be done using the adjusted means for ANCOVA, including adjusted means for ANCOVA, including LSD and BonferroniLSD and Bonferroni

Example of ANCOVAExample of ANCOVA

Imagine we gave subjects a self-esteem Imagine we gave subjects a self-esteem test, with scores of 1 to 10test, with scores of 1 to 10

Then we primed subjects with either Then we primed subjects with either positive or negative emotions.positive or negative emotions.

Then we asked them to spend a few Then we asked them to spend a few minutes writing about themselves.minutes writing about themselves.

Our dependent measure is the number of Our dependent measure is the number of positive emotion words they used (e.g. positive emotion words they used (e.g. happy, good)happy, good)

The null hypothesis is that the priming The null hypothesis is that the priming doesn’t make a difference after controlling doesn’t make a difference after controlling for self-esteemfor self-esteem

The alternative hypothesis is that the The alternative hypothesis is that the priming does make a difference after priming does make a difference after controlling for self-esteemcontrolling for self-esteem

Example of ANCOVA, cont.Example of ANCOVA, cont.

DataData

Subject #Subject # PrimingPriming Self-EsteemSelf-Esteem Positive WordsPositive Words

11 PositivePositive 11 77

22 PositivePositive 55 1010

33 PositivePositive 77 1111

44 NegativeNegative 88 77

55 NegativeNegative 33 44

66 NegativeNegative 66 55

ANCOVA in SPSSANCOVA in SPSS

To do ANCOVA in SPSS, all you need to To do ANCOVA in SPSS, all you need to do is add your covariate to the “covariate” do is add your covariate to the “covariate” box in the “univariate” menubox in the “univariate” menu

Everything else is the exact same as it is Everything else is the exact same as it is for ANOVAfor ANOVA