*! version 1.0.0 12jul11
help xblc (SJ11-3: st0215_1)

Title

xblc -- Tabulate and plot results after flexible modeling of a quantitative covariate

Syntax

xblc varlist, at(numlist) covname(varname)
[reference(#) pr eform format(%fmt)
level(#) equation(string)
generate(newvar1 newvar2 newvar3 newvar4)
scatter line
twoway_options]

Description

xblc computes point and interval estimates for predictions or
differences in predictions of the response variable evaluated at different
values of a quantitative covariate modeled using one or more transformations
of the original variable specified in varlist. It can be used after any
estimation command.

Options

at(numlist) specifies the values of the covariate specified in
covname(), at which xblc evaluates predictions or differences in
predictions. The values need to be in the current dataset. Covariates other
than the one specified with the covname() option are fixed at zero.
This is a required option.

covname(varname) specifies the name of the quantitative covariate. This
is a required option.

reference(#) specifies the reference value for displaying
differences in predictions.

pr computes and displays predictions (that is, mean response after
linear regression, log odds after logistic models, and log rate after Poisson
models with person-time as offset) rather than differences in predictions. To
use this option, check that the previously fit model estimates the constant
_b[_cons].

eform displays the exponential value of predictions or differences in
predictions.

format(%fmt) specifies the display format for presenting
numbers. format(%3.2f) is the default; see help format.

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

equation(string) specifies the name of the equation when you
have previously fit a multiple-equation model.

generate(newvar1 newvar2 newvar3 newvar4) specifies that the
values of the original covariate, predictions or differences in
predictions, and the lower and upper bounds of the confidence interval be
saved in newvar1,
newvar2, newvar3, and newvar4, respectively. This option is very
useful for presenting the results in a graphical form.

scatter plots the point estimates using twoway scatter and
confidence limits using twoway rcap.

line plots the point estimates and confidence limits using
twoway line.

twoway_options modifies the graph produced by the scatter or
line options.

Example

use http://nicolaorsini.altervista.org/data/pa_luts, clear

quietly summarize age

generate agec = age - r(mean)

// Generate spline transformations

mkspline tpas = tpa, knots(37.2 39.6 42.3 45.6) cubic

// Fit the model

logit ipss2 tpas1 tpas2 tpas3 agec

// Tabulate and plot results for a specific set of covariate values

xblc tpas1-tpas3, covname(tpa) at(29 32 35 38 40 43 45 48 52 55) reference(29) eform scatter

// Tabulate and plot results for any covariate values

levelsof tpa if inrange(tpa, 29,55)

xblc tpas1-tpas3, covname(tpa) at(`r(levels)') eform reference(29) line

// Personalize the graph

`"xblc tpas1-tpas3, covname(tpa) at(29 32 35 38 40 43 45 48 52 55) reference(29) eform scatter ytitle("Odds Ratio") xtitle("Total physical activity, MET-hours/day") yscale(log)"'

// Save the results for further use

capture drop pa or lb ub

`"xblc tpas1-tpas3, covname(tpa) at(29 32 35 38 40 43 45 48 52 55) reference(29) eform generate(pa or lb ub)"'

`"twoway (rcap lb ub pa, sort) (scatter or pa, sort), legend(off) scheme(s1mono) ytitle("Odds Ratios") xtitle("Total physical activity, MET-hours/day") name(f1, replace)"'

Authors

Nicola Orsini

Units of Nutritional Epidemiology and Biostatistics

National Institute of Environmental Medicine

Karolinska Institutet

nicola.orsini@ki.se

http://nicolaorsini.altervista.org

Sander Greenland

Department of Epidemiology and Statistics

University of California-Los Angeles

Los Angeles, CA

Also see

Article: Stata Journal, volume 11, number 3: st0215_1,

Stata Journal, volume 11, number 1: st0215

Manual: [R] lincom [R] predictnl

Help: [R] lincom [R] predictnl