Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Need help with the estimate statement in proc glm

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-21-2011 11:45 PM
(2458 views)

Hi,

I am running the following proc glm:

proc glm data=all order=data;

class smoke;

model lestrone=smoke age age*smoke/solution clparm;

run;

where smoke is a dichotomous variable (1=smoker, 0=non-smoker; age=continuous variable and lestrone=log transformed variable).

I need the following for my analyses:

1. The age effect: which i can get from proc glm

2. The smoke effect: again can get the main effect from proc glm.

3. The age + the smoke*age effect: HOW DO I GET THE ESTIMATES FOR THIS USING THE ESTIMATE STATEMENT??

Please advise and help.

Thank you!

We are conceptualizing these two as the age trend among non-smokers and the age trend among smokers respectively.

I am running the following proc glm:

proc glm data=all order=data;

class smoke;

model lestrone=smoke age age*smoke/solution clparm;

run;

where smoke is a dichotomous variable (1=smoker, 0=non-smoker; age=continuous variable and lestrone=log transformed variable).

I need the following for my analyses:

1. The age effect: which i can get from proc glm

2. The smoke effect: again can get the main effect from proc glm.

3. The age + the smoke*age effect: HOW DO I GET THE ESTIMATES FOR THIS USING THE ESTIMATE STATEMENT??

Please advise and help.

Thank you!

We are conceptualizing these two as the age trend among non-smokers and the age trend among smokers respectively.

11 REPLIES 11

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Not clear what you want. One interpretation of your question: You want to know if age has ANY effect, as a main effect or interaction? Some call this a simple main effect. There are other labels. You could use a contrast statement, but the syntax depends on the number of levels of the different factors. Here is a trick to do the same thing. In a second run of the program, take out "age" from the model statement:

model lestrone = smoke age*smoke / solution ...;

Then the test for age*smoke combines the main and interaction regarding age.

Another interpretation of your question is that you want to know the intercepts and slopes for smokers and non-smokers (for a change with age). Then, the model statement could be:

model lestrone = smoke age*smoke / solution noint ...;

The solution table will directly give you the intercepts and slopes if you make sure you use the "noint" option. Here, the displayed test for smoke is interpreted differently (whether the smoke means are simultaneously 0, not that they are equal to each other).

model lestrone = smoke age*smoke / solution ...;

Then the test for age*smoke combines the main and interaction regarding age.

Another interpretation of your question is that you want to know the intercepts and slopes for smokers and non-smokers (for a change with age). Then, the model statement could be:

model lestrone = smoke age*smoke / solution noint ...;

The solution table will directly give you the intercepts and slopes if you make sure you use the "noint" option. Here, the displayed test for smoke is interpreted differently (whether the smoke means are simultaneously 0, not that they are equal to each other).

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Than you for your quick response...

I need to generate the following for the following interpretations:

1. The age effect: interpreted as the age-trend among non-smokers

2. The age + the smoke*age effect.: conceptualized as the age-trend among smokers respectively.

So, based on the solutions you provided I think I should go with option 1 which is to run two models:

Model 1: model lestrone=smoke age age*smoke/solution

This will give me the main effect of age and smoke.

Model 2: model lestrone=smoke age*smoke/solution

This will combine age+age*smoke effect which I need for smokers.

Please let me know if I am on the right track...

THANK YOU!!

I need to generate the following for the following interpretations:

1. The age effect: interpreted as the age-trend among non-smokers

2. The age + the smoke*age effect.: conceptualized as the age-trend among smokers respectively.

So, based on the solutions you provided I think I should go with option 1 which is to run two models:

Model 1: model lestrone=smoke age age*smoke/solution

This will give me the main effect of age and smoke.

Model 2: model lestrone=smoke age*smoke/solution

This will combine age+age*smoke effect which I need for smokers.

Please let me know if I am on the right track...

THANK YOU!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Also, how would I get the same effect for a continuous variable such as bmi. So, if the model were:

proc glm;

model lestrone=age bmi ag*bmi;

run;

how do i get the age +age*bmi effect? Both age, bmi and lestrone are continuous variables..

Thank you!!

proc glm;

model lestrone=age bmi ag*bmi;

run;

how do i get the age +age*bmi effect? Both age, bmi and lestrone are continuous variables..

Thank you!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Things are a bit different with two continuous variables. I think you now want to test the joint hypothesis that the parameters for age and age*bmi are both 0 (i.e., no effect of age at all on the response). You could do this in two steps, by fitting the model you list, and then with

model lestrone = bmi;

One could then do a test based on the differences in error sum of squares.

As an alternative, you can use the model you list and add the contrast statement

model lestrone = age bmi age*bmi;

contrast 'joint' age 1, age*bmi 1;

run;

model lestrone = bmi;

One could then do a test based on the differences in error sum of squares.

As an alternative, you can use the model you list and add the contrast statement

model lestrone = age bmi age*bmi;

contrast 'joint' age 1, age*bmi 1;

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I can't thank you enough for all your prompt responses and advice.

Could you please explain in detail about the syntax of the contrast statement you have used:

contrast 'joint' age 1 age*bmi 1;

(Why are the values set to 1??)

Also, is there any online documentation which I can read on using contrast statement with two continuous variables..That will be very helpful!!

Many thanks again!

Could you please explain in detail about the syntax of the contrast statement you have used:

contrast 'joint' age 1 age*bmi 1;

(Why are the values set to 1??)

Also, is there any online documentation which I can read on using contrast statement with two continuous variables..That will be very helpful!!

Many thanks again!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Note, there is a comma in the contrast statement (before the age*bmi term). This is extremely important.

contrast 'joint' age 1, age*bmi 1;

With this syntax, you are jointly testing whether the parameter for age is 0 and the parameter for age*bmi is 0. The "1" is the number multiplying the estimated parameters in constructing the test statistic. If you did not have the comma, you would be doing a different test. With the listed contrast, a significant result could be because age by itself has an effect OR there is an interaction of age and bmi.

The syntax above works for two continuous variables. Learning about contrasts, and the syntax in GLM (MIXED, GLIMMIX) is a long process, and there is no way to really teach this here.

contrast 'joint' age 1, age*bmi 1;

With this syntax, you are jointly testing whether the parameter for age is 0 and the parameter for age*bmi is 0. The "1" is the number multiplying the estimated parameters in constructing the test statistic. If you did not have the comma, you would be doing a different test. With the listed contrast, a significant result could be because age by itself has an effect OR there is an interaction of age and bmi.

The syntax above works for two continuous variables. Learning about contrasts, and the syntax in GLM (MIXED, GLIMMIX) is a long process, and there is no way to really teach this here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you again.

So, if I need an actual estimate for the age+age*bmi effect for manuscript purposes can I replace the contrast statement with the estimate effect for instance:

estimate 'joint' age 1 age*bmi 1;

Is this a correct way to get an actual estimate for the age+age*bmi effect. I can also check this output by summing the age effect with the age*bmi effect from the raw GLM output

Many thanks again for all your prompt help!!

So, if I need an actual estimate for the age+age*bmi effect for manuscript purposes can I replace the contrast statement with the estimate effect for instance:

estimate 'joint' age 1 age*bmi 1;

Is this a correct way to get an actual estimate for the age+age*bmi effect. I can also check this output by summing the age effect with the age*bmi effect from the raw GLM output

Many thanks again for all your prompt help!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The estimate statement you gave is not appropriate. It would give the sum of the parameters for age and for age*bmi, and this does have any physical meaning.

I am not sure what you are asking. The output from the contrast statement I gave you gives the joint effect (as a SS or mean square, or F statistic, or P value) of age (including as an interaction). But it seems like you are asking for a parameter estimate. There is NO such thing as A parameter estimate for what you are asking. The solution table gives a parameter estimate for age and for age*bmi. These, together, give the effectS of age on the response variable. I am showing you how to test for both of the parameters together.

I am not sure what you are asking. The output from the contrast statement I gave you gives the joint effect (as a SS or mean square, or F statistic, or P value) of age (including as an interaction). But it seems like you are asking for a parameter estimate. There is NO such thing as A parameter estimate for what you are asking. The solution table gives a parameter estimate for age and for age*bmi. These, together, give the effectS of age on the response variable. I am showing you how to test for both of the parameters together.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I understand. Thank you for all your prompt help and advise.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Interpretation of results:

1. Continuous variables:

If I get a significant positive main age effect, a significant positive BMI main effect, a non-significant interaction effect for age*BMI, and a significant F-test for testing joint hypothesis of age and age*bmi, does it imply that age or BMI in itself have a significant effect on the outcome whereby an increase in either age or BMI lead to an increase in the outcome and not the interaction between age and BMI.

2. Categorical variables:

If the main effect of age on smoking (conceptualized as the age-trend for non-smokers) is significant and positive, main effect of smoking is significant and positive and the age+age*smoke effect (conceptualized as the age trend for smokers) is significant and positive, does it mean that for non-smokers as well as smokers with age there is an increase in the outcome. Also, we can compare the estimates between smokers vs. non-smokers to see which effect is stronger.

Please advise.

Thank you!!

1. Continuous variables:

If I get a significant positive main age effect, a significant positive BMI main effect, a non-significant interaction effect for age*BMI, and a significant F-test for testing joint hypothesis of age and age*bmi, does it imply that age or BMI in itself have a significant effect on the outcome whereby an increase in either age or BMI lead to an increase in the outcome and not the interaction between age and BMI.

2. Categorical variables:

If the main effect of age on smoking (conceptualized as the age-trend for non-smokers) is significant and positive, main effect of smoking is significant and positive and the age+age*smoke effect (conceptualized as the age trend for smokers) is significant and positive, does it mean that for non-smokers as well as smokers with age there is an increase in the outcome. Also, we can compare the estimates between smokers vs. non-smokers to see which effect is stronger.

Please advise.

Thank you!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

We have now moved this discussion from the syntax to estimate parameters or test for effects with SAS GLM to a discussion on general linear-model statistical analysis. Your new questions really have nothing to do with SAS procedures anymore, but with linear modeling. I can't really get into the many issues to consider in interpretation. I will just give a few comments.

>

> 1. Continuous variables:

>

> If I get a significant positive main age effect, a

> significant positive BMI main effect, a

> non-significant interaction effect for age*BMI, and a

> significant F-test for testing joint hypothesis of

> age and age*bmi, does it imply that age or BMI in

> itself have a significant effect on the outcome

> whereby an increase in either age or BMI lead to an

> increase in the outcome and not the interaction

> between age and BMI.

The joint effect is significant because of the significant main effect. The joint effect could be significant if either one of the simpler effects were significant. With multiple predictors, always start with the interaction and move down to main effects. With a non-sig. interaction (your situation), the change in the response with increase in one predictor does not depend on the other predictor. You may way to re-run the procedure without an interaction term to get estimates of the main-effect parameters.

>

> 2. Categorical variables:

>

> If the main effect of age on smoking (conceptualized

> as the age-trend for non-smokers) is significant and

> positive, main effect of smoking is significant and

> positive and the age+age*smoke effect (conceptualized

> as the age trend for smokers) is significant and

> positive, does it mean that for non-smokers as well

> as smokers with age there is an increase in the

> outcome. Also, we can compare the estimates between

> smokers vs. non-smokers to see which effect is

> stronger.

The joint effect could be significant, once again, if the main effect or interaction (or both) were significant. For your new questions, focus on the main effects and interactions (and temporarily forget about the joint effect). If there is a significant age*smoke interaction (always start with interactions), focus on that interaction. It means that the response variable changes with with age differently for smokers and non-smokers. In an early post I showed you how to use the noint option to directly get the intercept and slope for smokers and non-smokers. Look at the parameter estimates for age for smoker and non-smoker to see which is larger.

> Please advise.

>

> Thank you!!

>

> 1. Continuous variables:

>

> If I get a significant positive main age effect, a

> significant positive BMI main effect, a

> non-significant interaction effect for age*BMI, and a

> significant F-test for testing joint hypothesis of

> age and age*bmi, does it imply that age or BMI in

> itself have a significant effect on the outcome

> whereby an increase in either age or BMI lead to an

> increase in the outcome and not the interaction

> between age and BMI.

The joint effect is significant because of the significant main effect. The joint effect could be significant if either one of the simpler effects were significant. With multiple predictors, always start with the interaction and move down to main effects. With a non-sig. interaction (your situation), the change in the response with increase in one predictor does not depend on the other predictor. You may way to re-run the procedure without an interaction term to get estimates of the main-effect parameters.

>

> 2. Categorical variables:

>

> If the main effect of age on smoking (conceptualized

> as the age-trend for non-smokers) is significant and

> positive, main effect of smoking is significant and

> positive and the age+age*smoke effect (conceptualized

> as the age trend for smokers) is significant and

> positive, does it mean that for non-smokers as well

> as smokers with age there is an increase in the

> outcome. Also, we can compare the estimates between

> smokers vs. non-smokers to see which effect is

> stronger.

The joint effect could be significant, once again, if the main effect or interaction (or both) were significant. For your new questions, focus on the main effects and interactions (and temporarily forget about the joint effect). If there is a significant age*smoke interaction (always start with interactions), focus on that interaction. It means that the response variable changes with with age differently for smokers and non-smokers. In an early post I showed you how to use the noint option to directly get the intercept and slope for smokers and non-smokers. Look at the parameter estimates for age for smoker and non-smoker to see which is larger.

> Please advise.

>

> Thank you!!

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.