# Thread: How can I obtain contrast statment for linear trend test ?

1. ## How can I obtain contrast statment for linear trend test ?

Hi, I hope someone can explain this to me. I have obtained the following from the SAS website, but I cannot apply it to my data where I have 11 dose groups. I don't understand how the linear contrast given (-3 -1 1 3) is a linear trend ?

From a SAS example with variable dose at 4 levels :

proc glm;
class dose;
model y=dose;
contrast 'linear' dose -3 -1 1 3;
run;

I don't know how the contrast -3 -1 1 3 has been derived and so I can't derive my own contrast statement for my data with 11 dose levels. I am used to determining contrast statements by writing as below. In the example below I will assume I want to test :

Ho : mu11 - mu12 = 0

mu11 - mu12 = (mu+a1+b1+ab11) - (mu+a1+b2+ab12) = b1 - b2 + ab11 + ab12

I would then write out the contrast as contrast 'ab11 - ab12' b 1 -1;

Here for the linear trend I'm not sure how to express the contrast in terms of model parameters. Can anyone help. I guess if I could understand the example given above this would help me. Thanks.

2. ## Re: How can I obtain contrast statment for linear trend test ?

This is more of a SAS question than a biostatistics question. It seems that you would want to perform a contrast consisting of comparing the first and second dose, second and third dose, third and fourth dose...., and tenth and eleventh dose, which is a test with 10df. You should look up and double check the parameterization used by proc glm, since this will determine how you write the contrasts. Once you know the parameterization the rest is fairly straightforward, just write the contrast for comparing dose 1 and 2, dose 2 and 3,..., dose 10 and 11. If you add /e before the semicolon in the contrast statement, this will print the L vector, which can help you to double check that you specified the correct contrasts.

3. ## Re: How can I obtain contrast statment for linear trend test ?

Originally Posted by Bracknell
Ho : mu11 - mu12 = 0

mu11 - mu12 = (mu+a1+b1+ab11) - (mu+a1+b2+ab12) = b1 - b2 + ab11 + ab12

I would then write out the contrast as contrast 'ab11 - ab12' b 1 -1;

Here for the linear trend I'm not sure how to express the contrast in terms of model parameters. Can anyone help. I guess if I could understand the example given above this would help me. Thanks.

I didnt follow what you were trying to state here??

If you are trying to report a linear trend for your categorical variable that has 12 groups i can provide the code tomorrow (currently on a small/old tablet) . The contrast is just using a SAS style dummy coding. The code will look like yourr posted example but go out to something like -9 and 9. You can pribably find an example if you keep searching the web or i will post it in the morning.

4. ## Re: How can I obtain contrast statment for linear trend test ?

Dummy coding was an incorrect term for me to use, I think. The two posts below should provide the insight needed. The first provides examples up to 9 and the second provides some of the logit behind using the numbers they do in contrasts. So based on these it seems you should use the following:

Code:
``````proc glm;
class dose;
model y=dose;
contrast 'linear' dose -11 -9 -7 -5 -3 -1 1 3 5 7 9 11; /*sum to zero*/
run;
``````

http://www.ats.ucla.edu/stat/sas/lib...ASAnova_mf.htm

5. ## The Following User Says Thank You to hlsmith For This Useful Post:

Disvengeance (12-02-2014)

 Tweet

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts