# Re: How to write this code when age and it's quadratic fitted as

From: Arthur <asremlforum_at_VSNI.CO.UK>
Date: Thu, 10 Dec 2009 09:44:46 +0000

Dear luan sheng,

There is a difference between equivalent models and various ways of writing the same model. So for a job

AnimalID !P
Wt
Age
Age2 !=Age !^2
pedigree.txt
data.csv

An same animal model with quadratic regression can be written as

Wt ~ mu Age Age.Age !r AnimalID
or
Wt ~ mu Age Age2 !r AnimalID
or
Wt ~ mu Age pow(Age,2) !r AnimalID

An equivalent model is

Wt ~ pol(Age,2) !r AnimalID

The first 3 forms will give the same regression coefficviencts.
The fourth will give the same solution for the Animal effects, and the same
residual variance, but different regression coefficients for intercept, linear and quadratic coefficients because they are based on an orthogonalized version of the columns of the design matrix.

The design coefficients used for the pol() form are reported in the
.res file. The first column (intercept is unchanged). The second column
is formed by subtracting the mean Age from Age and scaling so the range is -1 to 1. The third is based on Age^2, adjusted for intercept and Age and rescaled.

The t value for the quadratic coefficient will be the same for all models, even though the actual coefficients will differ.

Say you have 4 Ages 1, 2, 3, 4

The design matrix for the original variables is
1 1 1
1 2 4
1 3 9
1 4 16

Standard orthogonal contrasts design matrix would be

1 -3 1
1 -1 -1
1 1 -1
1 3 1

However ASReml generates slightly different coefficients
after inserting some interpolation points so the quadratic curve could be plotted smoothly.

I trust this helps.

------------------------
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)

-------------------- m2f --------------------

Sent using Mail2Forum (http://www.mail2forum.com).