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 .
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?
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
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.
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 L 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
Show us the L-matrix.
Hi Paige,
Here are the results.
I add E in the model function.
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.
@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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.