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

Title

partpred-- partial predictions after fitting a model

Syntax

partprednewvar[if] [in], for(varlist)[options]

optionsDescription ------------------------------------------------------------------------- Optionsfor(varlist)variables included in partial predictionat(varname #...)define certain covariates to take single valuesref(varname #...)define reference values for certain covariatesci(newvars)createnewvarscontaining lower and upper confidence intervalsse(newvar)createnewvarcontaining standard error of predictionsconsinclude constant in predictioneformexponentiate partial predictionseq(name)name of equation used for prediction; default is to use the first equationlevel(#)set confidence level; default is level(95)

Description

partpredcalculates partial predictions for regression equations. Multi-equation models are supported via theeq()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 variablexis b then in the linear predictor it is included as b(x-#).

ci(newvars)requires the specification of twonewvars, 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 anewvar. The standard error of the partial prediction is generated. Note that if theeformoption is used the standard error is still reported on the original scale.

consforces the constant term in the partial prediction.

eformExponentiates 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 islevel(95)or as set by set level.

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 usesExample:partpredto 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

partpredto 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)

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

Also see