help for predxcat

Predicted means, medians, or probabilities for nominal X's

predxcat yvar [if exp] [in range],
xvar(xvar1 [xvar2])
[ adjust(covlist)
model
level(#)
linear
median
graph
bar
xsectional
cluster(cluster_var)
savepred(filename)
graph_options
]

Description

predxcat calculates and optionally graphs means from linear regression
models, medians from quantile regression models, or probabilities / proportions
from logistic regression models for one or two nominal X variables, adjusted
for covariates. If a second X is specified, means, medians, or probabilities /
proportions are calculated for all possible combinations of X categories, and an
interaction effect is tested. Optionally, model estimates and/or a graph
may be displayed. Indicator variables are created for xvar1. The lowest
indicator variable defaults to the reference group. If xvar2 is specified,
indicator variables are created for it, as well as interaction terms.
(Alternative to margins command.)

Variables and options required

yvar is the dependent variable

If yvar is continuous, defaults to linear regression

If yvar is binary (0,1), defaults to logistic regression

xvar(xvar1) is the nominal variable for categories of estimated
means, medians, or probabilities

xvar(xvar1 xvar2) gives categories of all combinations of
xvar1 and xvar2; interaction between xvar1 and xvar2 is
tested (Partial F for linear or quantile regression and likelihood ratio test
for logistic regression)

Options

adjust(covlist) lists any covariates. If none are specified,
unadjusted means, medians, or probabilities are reported. Covariates are set
to their mean, based on observations used in the analysis, or can be set to
user specified values (e.g., age=50 gender=1). (Note: if an adjust
variable is nominal with more than 2 categories, it must be defined with
indicator variables in the adjust list, whereas indicator variables
are created automatically in the xvar option)

model -- for display purposes only, this option prints the regression table

level(#) -- specifies the confidence level, in percent, for
calculation of confidence intervals (default=95%)

graph -- if one X (xvar1), graphs means, medians, or probabilities and
confidence intervals; if both xvar1 and xvar2 are specified, points
are graphed for each mean, median, or probability, but confidence intervals are
not graphed; xvar1 is used for the x-axis with separate points for
categories of xvar2

xsectional -- option for y axis label on graph for cross-sectional studies;
does not use the term "probabilties" in the label on the y axis

bar -- can be used with the graph option to display a bar graph
instead of points

linear -- requests linear regression when yvar is binary (0,1); if not
specified, logistic regression is assumed

median -- requests quantile regression when yvar is continuous

cluster(cluster_var) -- Name of cluster variable; adjusts standard
errors for intraclass correlation

savepred(filename) -- saves adjusted values and CI's to a Stata file

Examples

. predxcat chol, xvar(race) adjust(sbp age=50) model

Uses linear regression to calculate mean cholesterol level by race category,
adjusted for mean sbp and age=50; displays model

. predxcat chol, xvar(ses) adjust(sbp age) graph

Uses linear regression to calculate mean cholesterol by levels of
socio-economic status, adjusted for sbp and age; displays graph

. predxcat htn, xvar(gender race) adjust(age smoke etoh) graph bar xsectional

Uses logistic regression to calculate proportion of hypertensives for all
combinations of gender (2 categories) and race (4 categories) for a total
of 8 proportions, adjusted for age, smoking status, and alcohol consumption;
tests for interaction between gender and race

. predxcat htn, xvar(race gender) adjust(age smoke etoh) graph bar

Uses logistic regression to calculate the adjusted probabilities of hypertension
for all combinations of gender and race; bar graph of probabilities with race
on the x-axis

Also see

Manual: [U] 23 Estimation and post-estimation commands,

[R] margins

Author

J.Garrett, Professor, School of Medicine, University of North Carolina,
Chapel Hill, NC.
Email: joanne_garrett@med.unc.edu