turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Proc Genmod and continuous variables

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

Hi All,

i'm not sure if this is possible, i've been searching for a while...

i need to get the coefficients, standard errors and Wald's confidence intervals for a continuous variable in Proc genmod.

I can get the co-efficient estimate for Age (BetaA), and i know i can multiply the coefficient by each age to get the coefficient for each age (i.e 33 * BetaA), however, i'm unsure on how to get the corresponding Std. Error and Wald's confidence interval.

Also, it would be really handy if I can SAS to output the range of Ages used in ProcGenmod and output the values into ParameterEstimates (similar to the way it outputs them for categorical variables) - which is what i really want!

Many thanks

```
PROC GENMOD DATA = GLMDataset ;
WEIGHT Quote. ;
CLASS Gender /MISSING ;
MODEL PRICE = Gender Age
/DIST = Gamma.
LINK = LOG
TYPE1
TYPE3
;
OUTPUT OUT = GLMDatasetScored (keep = REFNO AVGPRICE PREMIUM: EST:. Gender Age )
PREDICTED = EST_AVGPRICE
LOWER = EST_LOWER_CI
UPPER = EST_UPPER_CI
RESDEV = EST_DEVRES
STDRESDEV = EST_STDDEVRES
RESLIK = EST_LIKLRES
XBETA = EST_LINEARPREDICTOR
;
ods output parameterestimates = _ParamEst
modelfit = _Modelfit
Type1 = _Type1
Type3 = _Type3;
RUN;
```

Accepted Solutions

Solution

3 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago - last edited 3 weeks ago

An other solution is to use proc plm for calculating predictions for any values in some dataset. In my little example I make a dataset "template" which contains the values of covariates. In your example this dataset should just have one observation with age=23.

The output data will contain the **linear** predictor. So if you want it on the original scale, you should add to this example a step where you calculate exp(pred). Confidence limit can be transformed with exp() also, and if you want the stderr on the original scale you should use the delta-rule.

```
*simulate som data;
data mydata;
do i=1 to 1000;
gender=(i<=500);
age=mod(i,100);
y=rand('gamma',exp(0.4*gender+0.01*age));
output;
end;
run;
*estimate the parameters and save the model;
proc genmod data=mydata;
class gender;
model y=gender age/dist=gamma link=log;
store mymodel;
run;
*constructing values of covariates for which we want predictions;
data template;
do gender=0,1;
do age=20 to 30;
output;
end;
end;
run;
*calculate confidence intervals with proc plm;
proc plm restore=mymodel;
score data=template out=predict lclm=lclm uclm=uclm stderr=stderr pred=pred;
run;
```

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

If you want the predicted mean for any given age in a given gender, that is in your OUTPUT OUT= data set. Just find the observation with the given age and gender. If what you want is a predicted mean for age averaged over the genders, then this would be something the LSMEANS statement would do for you if age were a CLASS (categorical) variable in the model. Since it's not, you can use the ESTIMATE statement to compute an estimate similar to an LS-mean. For example, assuming there are two genders and you want to treat them as having equal proportions in the population, then this statement would estimate the mean for age=20:

estimate 'age=20' intercept 1 gender .5 .5 age 20;

Solution

3 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago - last edited 3 weeks ago

An other solution is to use proc plm for calculating predictions for any values in some dataset. In my little example I make a dataset "template" which contains the values of covariates. In your example this dataset should just have one observation with age=23.

The output data will contain the **linear** predictor. So if you want it on the original scale, you should add to this example a step where you calculate exp(pred). Confidence limit can be transformed with exp() also, and if you want the stderr on the original scale you should use the delta-rule.

```
*simulate som data;
data mydata;
do i=1 to 1000;
gender=(i<=500);
age=mod(i,100);
y=rand('gamma',exp(0.4*gender+0.01*age));
output;
end;
run;
*estimate the parameters and save the model;
proc genmod data=mydata;
class gender;
model y=gender age/dist=gamma link=log;
store mymodel;
run;
*constructing values of covariates for which we want predictions;
data template;
do gender=0,1;
do age=20 to 30;
output;
end;
end;
run;
*calculate confidence intervals with proc plm;
proc plm restore=mymodel;
score data=template out=predict lclm=lclm uclm=uclm stderr=stderr pred=pred;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

great thanks, plm should get to what i want. i'll look into LSMeans and Estimate, that might help with communicating results to a non-technical audience.

Thank you both

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

Like the OUTPUT statement that I suggested earlier, PLM's SCORE statement will give you predictions for specified gender and age (note that you can use the ILINK option in PLM to get the predictions on the mean scale instead of on the linear predictor scale). But, as I mentioned, if you want predictions for specified levels of age without specifying gender (essentially averaging over genders as determined by the coefficients specified), then the ESTIMATE statement approach for doing an LS-mean-like calculation is helpful.