## Tuesday, December 13, 2005

### ANCOVA

ANCOVA, or analysis of covariance is a test in statistics that is often implemented in computing packages. ANCOVA is a merger of ANOVA
and regression for continuous variables. ANCOVA tests whether certain factors have an effect after controlling for quantitative predictors. The inclusion of covariates increases statistical power because it accounts for the variablity.
Equations
One-factor ANCOVA analysis
One factor analysis is appropriate when dealing with more than 3 populations; k populations. The single factor has k levels equal to the k populations. n samples from each population are chosen random from their respective population.

Calculating the Sum of Squared Deviates for the Independent Variable X and the Dependent Variable Y
The sum of squared deviates (SS): SSTy, SSTry, and SSEy must be calculated using the following equations for the dependent variable, Y. The SS for the covariate must also be calculated, the two necessary values are SSTx and and SSEx.

The total sum of squares determines the variablility of all the samples. nT represents the total number of samples:
$SST_y=\sum_{i=1}^n\sum_{j=1}^kY_{ij}^2-\frac{(\sum_{i=1}^n\sum_{j=1}^kY_{ij})^2}{n_T}$
The sum of squares for treatments determines the variablity between populations or factors. nk represents the number of factors:
$SSTr_y=\sum_{i=1}^n(\sum_{j=1}^kY_{ij}-\frac{\sum_{j=1}^k(Y_{ij})^2}{n_k})$
The sum of squares for error determines the variability within each population or factor. nn represents the number of samples with a given population:
$SSE_y=\sum_{j=1}^k(\sum_{i=1}^nY_{ij}^2-\frac{\sum_{i=1}^k(Y_{ij})^2}{n_n})$
The total sum of squares is equal to the sum of the sum of squares for treatments and the sum of squares for error:

SSTy = SSTry + SSEy

Calculating the Covariance of X and Y

The total sum of square covariates determines the covariance of X and Y within the all the data samples:
$SCT=\sum_{i=1}^n\sum_{j=1}^kX_{ij}^2Y_{ij}^2-\frac{(\sum_{i=1}^n\sum_{j=1}^kX_{ij})^2Y_{ij}^2}{n_T}$
$SCE=\sum_{j=1}^k(\sum_{i=1}^nX_{ij}^2Y_{ij}^2-\frac{\sum_{i=1}^k(X_{ij}Y_{ij})^2}{n_n})$

$r_T^2$ is the correlation between X and Y
$r_T^2=\frac{SCT^2}{SST_xSST_y}$
$r_n^2=\frac{SCE^2}{SSE_xSSE_y}$
The proportion of covariance is substracted from the dependent, SSy values:
$SST_{yadj}=SST_y-r_T^2$
$SSE_{yadj}=SSE_y-r_n^2$

Adjusting the means of each population k

The mean of each popluation is adjusted in the following manner:
$M_{y_iadj}=M_{y_i}-\frac{SCE_y}{SCE_x}(M_{x_i}-M_{x_T})$

Analysis Using Adjusted Sum of Squares Values

Mean squares for treatments where dfTr is equal to NTk − 1. dfTr is one less than in ANOVA to account for the convariance and dfE = k − 1:
$MSTr=\frac{SSTr}{df_{Tr}}$
$MSE=\frac{SSE}{df_E}$
The F statistic
$F_{df_E,df_{Tr}}=\frac{MSTr}{MSE}$