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

Hi,

 

So I am having problems with estimate statement in proc glimmix.

I have the following proc glimmix:

 

proc glimmix data=newadr noclprint method=laplace;
class nMD procyear(ref=first);
model adeno_yes(event=last)=procyear/cl dist=binary link=logit solution;
random procyear/ sub=nMD type=ar(1) s CL;
estimate "Year 2012" int 1 procyear 1 0 0 0 0 0 0/ ilink;
estimate "Year 2013" int 1 procyear 0 1 0 0 0 0 0/ ilink;
estimate "Year 2014" int 1 procyear 0 0 1 0 0 0 0/ ilink;
estimate "Year 2015" int 1 procyear 0 0 0 1 0 0 0/ ilink;
estimate "Year 2016" int 1 procyear 0 0 0 0 1 0 0/ ilink;
estimate "Year 2017" int 1 procyear 0 0 0 0 0 1 0/ ilink;
estimate "Year 2018" int 1 procyear 0 0 0 0 0 0 1/ ilink;
run;

 

My procyear variable has the following values: 2012, 2013, 2014, 2015, 2016, 2017, 2018

 

The output is parameter estimates are:

Solutions for Fixed Effects
Effect procyear Estimate Standard
Error
DF t Value Pr > |t| Alpha Lower Upper
intercept   -1.2370 0.1397 231 -8.85 <.0001 0.05 -1.5123 -0.9616
procyear 2013 -0.1178 0.1549 231 -0.76 0.4476 0.05 -0.4230 0.1873
procyear 2014 -0.02350 0.1440 231 -0.16 0.8705 0.05 -0.3072 0.2602
procyear 2015 0.1533 0.1328 231 1.15 0.2494 0.05 -0.1083 0.4149
procyear 2016 0.5146 0.1218 231 4.23 <.0001 0.05 0.2746 0.7545
procyear 2017 0.8057 0.1076 231 7.48 <.0001 0.05 0.5936 1.0178
procyear 2018 0.8671 0.09087 231 9.54 <.0001 0.05 0.6880 1.0461
procyear 2012 0 . . . . . . .

 

The output I got for the estimate statement is:
Estimates
Label Estimate Standard
Error
DF t Value Pr > |t| Mean Standard
Error
Mean
Year 2012 -1.3548 0.1439 231 -9.41 <.0001 0.2051 0.02347
Year 2013 -1.2605 0.1390 231 -9.07 <.0001 0.2209 0.02392
Year 2014 -1.0837 0.1354 231 -8.01 <.0001 0.2528 0.02557
Year 2015 -0.7224 0.1337 231 -5.40 <.0001 0.3269 0.02941
Year 2016 -0.4313 0.1313 231 -3.28 0.0012 0.3938 0.03135
Year 2017 -0.3699 0.1313 231 -2.82 0.0053 0.4086 0.03172
Year 2018 -1.2370 0.1397 231 -8.85 <.0001 0.2250 0.02437

 

I'm not sure this makes sense.  Based on my estimate statement, I am expecting estimates to be:

year 2012   -1.2370

year 2013   -1.3548

year 2014   -1.2605

year 2015   -1.0837

year 2016   -0.7224

year 2017   -0.4313

year 2018   -0.3699

 

It seems like it is off by a year.  What am I doing wrong here?

 

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
edhuang
Obsidian | Level 7

Hi Dave,

 

Your idea makes sense.  I have the appropriate changes to the estimate to the following statement and it works.  

Thanks.  

 

proc glimmix data=newadr_ge200_avg_2012_v2 noclprint method=laplace;
class nMD procyear(ref=first);
model adeno_yes(event=last)=procyear/cl dist=binary link=logit solution;
random procyear/ sub=nMD type=ar(1) s CL;
estimate "Year 2012" int 1 procyear 0 0 0 0 0 0 1/ ilink;
estimate "Year 2013" int 1 procyear 1 0 0 0 0 0 0/ ilink;
estimate "Year 2014" int 1 procyear 0 1 0 0 0 0 0/ ilink;
estimate "Year 2015" int 1 procyear 0 0 1 0 0 0 0/ ilink;
estimate "Year 2016" int 1 procyear 0 0 0 1 0 0 0/ ilink;
estimate "Year 2017" int 1 procyear 0 0 0 0 1 0 0/ ilink;
estimate "Year 2018" int 1 procyear 0 0 0 0 0 1 0/ ilink;
run;

View solution in original post

6 REPLIES 6
SteveDenham
Jade | Level 19

The error is indeed in your estimate statements.  I would suggest one of the following:

1. Use an LSMEANS statement with an ILINK option and an E option.  The latter will assist you in aligning your ESTIMATE coefficients with the correct parameter values.

2. Shift to LSMESTIMATE statements.  These are usually much easier to create and troubleshoot than the ESTIMATE statement.

3.  Add the NOINT option to the MODEL statement.

 

SteveDenham

edhuang
Obsidian | Level 7
Hi Steve,

Thanks for your suggestions. It does seem to correct the problem.
However, one thing I noticed is that when the ref group (2018 vs 2012 as
reference) is changed, the mean results output seem to be slightly
different. Why is this? I figure it should be the same, no?

proc glimmix data=newadr_ge200_avg_2012_v2 noclprint method=laplace;
class nMD procyear;
model adeno_yes(event=last)=procyear/cl dist=binary link=logit solution;
random procyear/ sub=nMD type=ar(1) s CL;
lsmeans procyear/ ilink e;
run;

HTML clipboard
Solutions for Fixed Effects
Effect procyear Estimate Standard
Error DF t Value Pr > |t| Alpha Lower Upper
Intercept -0.3822 0.1366 231 -2.80 0.0056 0.05 -0.6514 -0.1130
procyear 2012 -1.0368 0.1557 231 -6.66 <.0001 0.05 -1.3435 -0.7302
procyear 2013 -0.9708 0.1420 231 -6.84 <.0001 0.05 -1.2506 -0.6910
procyear 2014 -0.8767 0.1284 231 -6.83 <.0001 0.05 -1.1298 -0.6237
procyear 2015 -0.7011 0.1139 231 -6.16 <.0001 0.05 -0.9254 -0.4768
procyear 2016 -0.3416 0.09702 231 -3.52 0.0005 0.05 -0.5328 -0.1505
procyear 2017 -0.05344 0.07212 231 -0.74 0.4594 0.05 -0.1955 0.08865
procyear 2018 0 . . . . . . .

HTML clipboard
Coefficients for procyear Least Squares Means
Effect procyear Row1 Row2 Row3 Row4 Row5 Row6 Row7
Intercept 1 1 1 1 1 1 1
procyear 2012 1
procyear 2013 1
procyear 2014 1
procyear 2015 1
procyear 2016 1
procyear 2017 1
procyear 2018 1
HTML clipboard
procyear Least Squares Means
procyear Estimate Standard
Error DF t Value Pr > |t| Mean Standard
Error
Mean
2012 -1.4190 0.1513 231 -9.38 <.0001 0.1948 0.02374
2013 -1.3530 0.1447 231 -9.35 <.0001 0.2054 0.02362
2014 -1.2589 0.1405 231 -8.96 <.0001 0.2212 0.02420
2015 -1.0833 0.1375 231 -7.88 <.0001 0.2529 0.02597
2016 -0.7238 0.1364 231 -5.31 <.0001 0.3265 0.02999
2017 -0.4356 0.1350 231 -3.23 0.0014 0.3928 0.03221
2018 -0.3822 0.1366 231 -2.80 0.0056 0.4056 0.03294



However, if I put ref=first to indicate 2012 as reference group

proc glimmix data=newadr_ge200_avg_2012_v2 noclprint method=laplace;
class nMD procyear*(ref=first)*/;
model adeno_yes(event=last)=procyear/cl dist=binary link=logit solution;
random procyear/ sub=nMD type=ar(1) s CL;
lsmeans procyear/ ilink e;
run;
HTML clipboard
Solutions for Fixed Effects
Effect procyear Estimate Standard
Error DF t Value Pr > |t| Alpha Lower Upper
Intercept -1.2370 0.1397 231 -8.85 <.0001 0.05 -1.5123 -0.9616
procyear 2013 -0.1178 0.1549 231 -0.76 0.4476 0.05 -0.4230 0.1873
procyear 2014 -0.02350 0.1440 231 -0.16 0.8705 0.05 -0.3072 0.2602
procyear 2015 0.1533 0.1328 231 1.15 0.2494 0.05 -0.1083 0.4149
procyear 2016 0.5146 0.1218 231 4.23 <.0001 0.05 0.2746 0.7545
procyear 2017 0.8057 0.1076 231 7.48 <.0001 0.05 0.5936 1.0178
procyear 2018 0.8671 0.09087 231 9.54 <.0001 0.05 0.6880 1.0461
procyear 2012 0 . . . . . . .


HTML clipboard
Coefficients for procyear Least Squares Means
Effect procyear Row1 Row2 Row3 Row4 Row5 Row6 Row7
Intercept 1 1 1 1 1 1 1
procyear 2013 1
procyear 2014 1
procyear 2015 1
procyear 2016 1
procyear 2017 1
procyear 2018 1
procyear 2012 1


HTML clipboard
procyear Least Squares Means
procyear Estimate Standard
Error DF t Value Pr > |t| Mean Standard
Error
Mean
2013 -1.3548 0.1439 231 -9.41 <.0001 0.2051 0.02347
2014 -1.2605 0.1390 231 -9.07 <.0001 0.2209 0.02392
2015 -1.0837 0.1354 231 -8.01 <.0001 0.2528 0.02557
2016 -0.7224 0.1337 231 -5.40 <.0001 0.3269 0.02941
2017 -0.4313 0.1313 231 -3.28 0.0012 0.3938 0.03135
2018 -0.3699 0.1313 231 -2.82 0.0053 0.4086 0.03172
2012 -1.2370 0.1397 231 -8.85 <.0001 0.2250 0.02437

STAT_Kathleen
SAS Employee

You may replicate the Solution For Fixed Effects using an ESTIMATE statement.  It appears your YEAR variable has 7 levels and using REF=FIRST try the ESTIMATE statements shown below.  Also keep in mind the estimates in the Solutions for Fixed Effects table are slopes estimates on the logit scale.

estimate '2013 pe' time 1 0 0 0 0 0 -1;

estimate '2014 pe' time 0 1 0 0 0 0 -1;

estimate '2015 pe' time 0 0 1 0 0 0 -1;

estimate '2016 pe' time 0 0 0 1 0 0 -1;

estimate '2017 pe' time 0 0 0 0 1 0 -1;

estimate '2018 pe' time 0 0 0 0 0 1 -1;

 

edhuang
Obsidian | Level 7

Hi Kathleen,

 

Thanks for your suggestions.  I tried it, but it turned out the estimate cannot be estimated.

I believe that PROC GLIMMIX default is GLM coding for the class statement.  What you have suggested is for effect coding for class statement which to my understanding is not available in PROC GLIMMIX.

StatDave
SAS Super FREQ

In your original post, the output shows that the first parameter for PROCYEAR is associated with 2013, not 2012. The values in the ESTIMATE statement are associated with parameters in the order shown in the output. So, the first ESTIMATE statement gives the estimate for 2013. That is because you set the reference level to 2012 which moves that year to the last level as you can see in the output.

edhuang
Obsidian | Level 7

Hi Dave,

 

Your idea makes sense.  I have the appropriate changes to the estimate to the following statement and it works.  

Thanks.  

 

proc glimmix data=newadr_ge200_avg_2012_v2 noclprint method=laplace;
class nMD procyear(ref=first);
model adeno_yes(event=last)=procyear/cl dist=binary link=logit solution;
random procyear/ sub=nMD type=ar(1) s CL;
estimate "Year 2012" int 1 procyear 0 0 0 0 0 0 1/ ilink;
estimate "Year 2013" int 1 procyear 1 0 0 0 0 0 0/ ilink;
estimate "Year 2014" int 1 procyear 0 1 0 0 0 0 0/ ilink;
estimate "Year 2015" int 1 procyear 0 0 1 0 0 0 0/ ilink;
estimate "Year 2016" int 1 procyear 0 0 0 1 0 0 0/ ilink;
estimate "Year 2017" int 1 procyear 0 0 0 0 1 0 0/ ilink;
estimate "Year 2018" int 1 procyear 0 0 0 0 0 1 0/ ilink;
run;

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 6 replies
  • 1543 views
  • 0 likes
  • 4 in conversation