help for predxcon

Predicted means, medians, or proportions for a continuous X variable

predxcon yvar [if exp] [in range], xvar(xvar) from(#) to(#) inc(#) [ adjust(covlist) poly(#) class(classvar) model graph level(#) linear median nolist cluster(cluster_var) savepred(filename) graph_options ]


predxcon calculates and prints predicted values and 95% confidence intervals for linear, quantile, or logistic model estimates for a continuous X variable, adjusted for covariates. Default prints predicted values and confidence intervals; model estimates and graph can be shown. Optionally a quadradic or a quadratic and cubic term can be added to the model. An interaction between X and a nominal variable can be estimated and graphed. Dummy variables are created for the nominal variable with the lowest category defaulting to the reference group.

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(xvar) -- continuous independent variable (interval or ordinal)

from(#) -- bottom value for xvar

to(#) -- top value for xvar

inc(#) -- increment size between bottom and top values (defaults to 1)


adjust(covlist) lists any covariates. If none are specified, unadjusted means, medians, or proportions 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 dummy variables in the adjust list, whereas dummy variables are created automatically in the xvar option)

poly(2 or 3) -- polynomial terms added: 2=quadratic 3=quadradic and cubic (will not work with the median option)

class(classvar) -- nominal variable for an xvar by classvar interaction

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

graph -- displays graph of predicted values and 95% confidence intervals; if class() is requested, confidence intervals are not displayed

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

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

nolist -- does not print list of predicted values and 95% CIs

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


. predxcon chol, xvar(age) from(20) to(80) inc(5) adjust(sys hra)

Using linear regressin, calculates the predicted cholesterol values for 5-year increments of age from 20 years to 80 years (i.e., age=20,25,30,...,80) adjusted for systolic blood pressure and heart rate; displays predicted values, but does not display model or graph

. predxcon chol, xvar(sys) f(60) t(280) i(20) adj(hra) graph class(race)

Using linear regression, calculates the predicted cholesterol values for systolic blood pressure readings from 60 to 300 in 20mm/hg increments by categories of race, adjusted for heart rate; tests for an age by race interaction; displays graph and list of predicted values

. predxcon htn, xvar(chol) f(100) t(300) i(20) class(race) graph

Using logistic regression, calculates the unadjusted probability of hypertension for cholesterol from 100 to 200 in 20-unit increments, by categories of race; displays a likelihood ratio test for interaction; graphs the results

. predxcon htn, xvar(age) f(40) t(80) poly(3) adj(chol=250) graph

Using logistic regression, calculates the probabilitity of hypertension for 1-yr increments of age; terms for age-squared and age-cubed included in model using the poly(3) option; also adjusted to a cholesterol level of 250; displays graph


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