BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jie111
Quartz | Level 8

I am analysing the slope of one continuous_variable during follow-up across groups.

In the following code, t=fu_year.

I used PROC MIXED. In the procedure, I used ESTIMATE to calculate the difference between slopes of the corresponding group and the reference group (group 4 here).

 



proc mixed data=dataset order=formatted PLOTS(MAXPOINTS= 100000); class t group (ref='4'); model continuous_var=fu_year group group*fu_year/ solution ddfm=kr; repeated t /subject=projid_mixed type=un; estimate "slope difference for group 1, ref=group4" fu_year 0 group*fu_year 1 0 0 -1 0 0/cl;
estimate "slope difference for group 2, ref=group4" fu_year 0 group*fu_year 0 1 0 -1 0 0/cl;
estimate "slope difference for group 3, ref=group4" fu_year 0 group*fu_year 0 0 1 -1 0 0/cl;
estimate "slope difference for group 5, ref=group4" fu_year 0 group*fu_year 0 0 0 -1 1 0/cl;
estimate "slope difference for group 6, ref=group4" fu_year 0 group*fu_year 0 0 0 -1 0 1/cl; run;

 

The point estimate is supposed to be same from the table named "solution for fixed effects"  and the table named "estimate".

however, my results varied in these two tables.

 

In the "solution for fixed effects"

Group 1,2,3 have a significantly faster decline (fu_year*group) over time than group 4 .

Jie111_0-1634646149683.png

 

 

However, in the table for Estimate, both the estimate and the P-value changed. Is anyone know why the estimates were different between those two tables? Is this normal?

Jie111_1-1634646267178.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jiltao
SAS Super FREQ

The (ref='4') option in the CLASS statement essentially puts 4 as the last level for GROUP. So in your ESTIMATE statement, you should put -1 as the last coefficient (the 6th one) --

 

estimate "slope difference for group 1, ref=group4" fu_year 0 group*fu_year 1 0 0 0 0 -1 /cl;

 

Please see if this helps.

 

Thanks,

Jill

View solution in original post

10 REPLIES 10
ballardw
Super User

It often helps if you point out the specific values of concern by referencing a row label or similar and the specific statistic or column heading in both sources so we can tell what you are looking at and questioning, or pick a single instance for discussion of differences.

 

 

 

 

SteveDenham
Jade | Level 19

It might be that be setting group 4 to be the reference, that the indexing gets shifted such that your ESTIMATE statements are now messed up somehow.  Try adding the 'E' option to print out the matrix.  The other thing to recall is that the estimate statement combines multiple entries from the solution vector to calculate the estimates, so there may be some small differences in the estimated value, and certainly some differences in the standard error, which in the estimate is a standard error of a linear combination of the parameters, and so should be a bit larger. This will affect the t values and thus the associated p values.

 

SteveDenham

Jie111
Quartz | Level 8
Thank you Steve Denham. I check the L matrix, in the estimate, I also used group 4 as the reference group. Is the different estimate and P-value normal?
Jie111
Quartz | Level 8

Hi Paige,

Here are the results.

I add E in the model function.

Jie111_0-1634663564793.png

Jie111_1-1634663576818.png

 

PaigeMiller
Diamond | Level 26

I am skeptical.

 

The code you show does not and cannot produce the second output that you show in your original message. The second output says "Slope for BMI trajectories" but there is no such thing in your code.

 

So to me the most likely explanation is that the screen captures in your original message are not from the same run of the code, and therefore don't have to match.

--
Paige Miller
Jie111
Quartz | Level 8
I rerun it with excluding the (ref='4') and got the same estimates and P value.

class t group (ref='4'); --> class t group;

PaigeMiller
Diamond | Level 26

@Jie111 wrote:
I rerun it with excluding the (ref='4') and got the same estimates and P value.

class t group (ref='4'); --> class t group;


Yes, I think this is expected. It's the same model whether your use (ref='4') or not.

--
Paige Miller
Jie111
Quartz | Level 8
sorry for that. I revised the question. Hope it is clear now.
jiltao
SAS Super FREQ

The (ref='4') option in the CLASS statement essentially puts 4 as the last level for GROUP. So in your ESTIMATE statement, you should put -1 as the last coefficient (the 6th one) --

 

estimate "slope difference for group 1, ref=group4" fu_year 0 group*fu_year 1 0 0 0 0 -1 /cl;

 

Please see if this helps.

 

Thanks,

Jill

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Discussion stats
  • 10 replies
  • 1764 views
  • 3 likes
  • 5 in conversation