BookmarkSubscribeRSS Feed
BayzidurRahman
Obsidian | Level 7

I am fitting the following model with my count data.

proc glimmix data=tre;
class ward mrn period sex;
model tre_count=period period*sex sexaknt1-aknt3 / dist=poisson link=log offset=logord;
random intercept / subject=ward;
run; 

How can I add a new variable in the existing dataset with predicted rate from the fitted model?

6 REPLIES 6
Ksharp
Super User
data insure;
input id n c car$ age;
carnum=1;
if car="medium" then carnum=2;
if car="large" then carnum=3;
ln = log(n);
datalines;
1 500 42 small 1
1 1200 37 medium 1
1 100 1 large 1
1 400 101 small 2
1 500 73 medium 2
1 300 14 large 2
2 50 4 small 1
2 10 7 medium 1
2 300 10 large 1
2 420 101 small 2
2 510 73 medium 2
2 30 14 large 2
3 70 40 small 1
3 150 17 medium 1
3 30 20 large 1
3 250 10 small 2
3 50 3 medium 2
3 300 140 large 2
;


proc glimmix data=insure;
class car age;
model c=car age / dist=poisson link=log offset=ln;
random intercept / subject=id;
store gmxplants;
run; 
proc plm restore=gmxplants;
score data=insure out=out pred stderr lclm uclm / nooffset ilink;
run;
BayzidR
Calcite | Level 5

Thanks very much.
How can I report the regression coefficients with their 95% for the variables age and car?

SAS_Rob
SAS Employee

The SOLUTION and CL options on the MODEL statement requests the parameter estimates and that t-type confidence limits be constructed for each of the fixed-effects parameter estimates. The confidence level is 0.95 by default; this can be changed with the ALPHA= option.

model tre_count=period period*sex sexaknt1-aknt3 / dist=poisson link=log offset=logord cl solution;

 

 

BayzidR
Calcite | Level 5

Thanks. Is there any option to obtain the IRR or exponentiation coefficients?

StatDave
SAS Super FREQ

All these questions, including the rate ratio, are addressed in this note. It is illustrated using PROC GENMOD, but the same basic methods apply.

ballardw
Super User

Short answer: You can't.

Reason, once a data set is created in SAS adding a variable requires REPLACING the data set. You don't "add" a variable to it. If you want the same name you replace the data set.

 

Basic approach would be to create a data set with the predicted rate. That would be the OUTPUT statement

 

Output out=newdatasetname  pred=nameofpredictedvaluevariable ;

 

Suggestion: DO NOT reuse the source data set name and replace it. If you make a mistake you may corrupt your existing data.

 


@BayzidurRahman wrote:

I am fitting the following model with my count data.

proc glimmix data=tre;
class ward mrn period sex;
model tre_count=period period*sex sexaknt1-aknt3 / dist=poisson link=log offset=logord;
random intercept / subject=ward;
run; 

How can I add a new variable in the existing dataset with predicted rate from the fitted model?


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 810 views
  • 2 likes
  • 6 in conversation