help partpred
-------------------------------------------------------------------------------

Title

partpred -- partial predictions after fitting a model

Syntax

partpred newvar [if] [in] , for(varlist) [options]

options Description ------------------------------------------------------------------------- Options for(varlist) variables included in partial prediction at(varname # ...) define certain covariates to take single values ref(varname # ...) define reference values for certain covariates ci(newvars) create newvars containing lower and upper confidence intervals se(newvar) create newvar containing standard error of predictions cons include constant in prediction eform exponentiate partial predictions eq(name) name of equation used for prediction; default is to use the first equation level(#) set confidence level; default is level(95)

Description

partpred calculates partial predictions for regression equations. Multi-equation models are supported via the eq() option.

Options

for(varlist) defines which variables are to be included in the prediction. Factor variables are allowed.

at(varname # ...) allows some covariates to take single values over the whole sample.

ref(varname # ...) defines a reference value for continuous variables. For example if the coefficient of variable x is b then in the linear predictor it is included as b(x-#).

ci(newvars) requires the specification of two newvars, giving the variable names for the lower and upper confidence limits. The level of the confidence intervals is determined by level(#).

se(newvar) requires the specification of a newvar. The standard error of the partial prediction is generated. Note that if the eform option is used the standard error is still reported on the original scale.

cons forces the constant term in the partial prediction.

eform Exponentiates the partial prediction (and confidence intervals if applicable).

eq(name) Gives the equation name for multiple equations. The default is to use the first equation.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

Example: When using non-linear effects using polynomials, splines or similar, it can be useful to plot with a reference value. The following fits a non-linear effect of age using polynomials and then uses partpred to obtain the hazard ratio for different ages with age 60 as the reference age.

. webuse brcancer . stset rectime, failure(censrec=1) scale(365.25) . gen age = x1 . gen age2 = age^2 . stcox age age2 hormon . partpred hr_age, for(age age2) ref(age 60 age2 3600) ci(hr_age_lci hr_age_uci > ) eform . twoway (rarea hr_age_lci hr_age_uci age, sort pstyle(ci)) /// (line hr_age age, sort) /// , legend(off) xtitle(age) ytitle(Hazard Ratio) (click to run)

Factor variables can be used. The following fits an interaction between hormon therapy and age and then uses partpred to obtain an estimate of the hazard ratio for hormone therapy as a function of age.

. webuse brcancer . stset rectime, failure(censrec=1) scale(365.25) . gen age = x1 . gen age2 = age^2 . stcox (c.age c.age2)##hormon . partpred hr_hormon if hormon==1, for(1.hormon 1.hormon#c.age 1.hormon#c.age2) > /// ci(hr_hormon_lci hr_hormon_uci) eform . twoway (rarea hr_hormon_lci hr_hormon_uci age, sort pstyle(ci)) /// (line hr_hormon age, sort) /// , legend(off) xtitle(age) ytitle(Hazard Ratio) (click to run)

Author

Paul Lambert (paul.lambert@le.ac.uk).

Also see