I'm trying to run the proc genmod command, but when I look at level 3, it has 0s across the board but levels 1 and 2 have values. How do I get my level 3 data to show up or interpret them I was told that this was the correct output for what Im trying to do and that I only need 2 estimates to calculate the 3rd but Im unsure of how to do that. Would level 1 be considered the intercept in this case? Would level 2 be considered level 1 and level 3 considered level 2?
Data UGAStudent_DATA;
Set date_difference;
if cd4 <= 200 then cd4_levels='1';
if cd4 >=201 <=500 then cd4_levels='2';
if cd4 > 500 then cd4_levels='3';
run;
proc genmod data= ugastudent_data;
class cd4_levels /param=glm ;
model Factor1 = cd4_levels n_Duration_on_ART_months ;
run;
This is the default way that SAS (all procedures) handles categorical variables. There are different ways to parameterize the model, each with different coefficients, but each parameterization produces the same model and predictions. Under your parameterization, the value of the last level alphabetically (in your case, level 3) is set to zero. The true effect for level 1 is really intercept + level 1 coefficient = 7.76 + 0.3812, and so on.
Instead of trying to interpret the model coefficients of class variables, you probably want to use the LSMEANS command and interpret the LSMEANS values.
A better idea, in my opinion, is to treat CD4 as a continuous variable rather than as a class variable CD4_LEVELS.
This is the default way that SAS (all procedures) handles categorical variables. There are different ways to parameterize the model, each with different coefficients, but each parameterization produces the same model and predictions. Under your parameterization, the value of the last level alphabetically (in your case, level 3) is set to zero. The true effect for level 1 is really intercept + level 1 coefficient = 7.76 + 0.3812, and so on.
Instead of trying to interpret the model coefficients of class variables, you probably want to use the LSMEANS command and interpret the LSMEANS values.
A better idea, in my opinion, is to treat CD4 as a continuous variable rather than as a class variable CD4_LEVELS.
Thank you,
Ive added in the lsmeans command. The lsmeans estimate represents severity of disease. So is the interpretation of the LsMeans simply that the higher the mean, the more severity occurs in that particular CD4 level?
@UGAstudent wrote:
Thank you,
Ive added in the lsmeans command. The lsmeans estimate represents severity of disease. So is the interpretation of the LsMeans simply that the higher the mean, the more severity occurs in that particular CD4 level?
Yes, this is the estimated mean value of Factor1 based upon the level of CD4_LEVEL. You can also turn on other options in the LSMEANS statement to test whether or not the cd4_level values has statistically different means.
How do I get my level 3 data to show up or interpret them I was told that this was the correct output for what Im trying to do and that I only need 2 estimates to calculate the 3rd but Im unsure of how to do that.
To determine the effect for Level 1, everything else held constant:
Level1: Intercept + Level1
Level2: Intercept + Level2
Level3: Intercept
Here's a good write up on interpreting categorical/dummy variables that may help you understand it, especially if you work through it.
Thank you!
Im controlling for ART duration, so when interpreting for lets say level 1, im not also controlling for levels 2 and 3 since they are the same variable correct?
@UGAstudent wrote:
Thank you!
Im controlling for ART duration, so when interpreting for lets say level 1, im not also controlling for levels 2 and 3 since they are the same variable correct?
I would say this is not correct.
There is no such concept of "controlling for" for dummy variables representing levels of a categorical variable.
@Reeza wrote:
How do I get my level 3 data to show up or interpret them I was told that this was the correct output for what Im trying to do and that I only need 2 estimates to calculate the 3rd but Im unsure of how to do that.
To determine the effect for Level 1, everything else held constant:
Level1: Intercept + Level1
Level2: Intercept + Level2
Level3: Intercept
I would quibble with this -- I would say the following:
Level1: Intercept + Level1
Level2: Intercept + Level2
Level3: Intercept + Level3
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.