.-
help for ^prgen1^ - 1.6.1 - 22Aug2005
.-

Generate predicted values for regression models.
---------------------------------------------------------------------------
Note: See prgen for revised command that computes confidence intervals.

To compute the predicted values with all variables but varname held at values
specified by x() and rest():

    ^prgen1^ varname, ^gen^erate^(^newvar^)^[^f^rom^(^#^)^ ^t^o^(^#^)^ ^n^cases^(^#^)^]
        [^x(^variables_and_values^)^][^r^est^(^stat^)^][^max^cnt ^(^#^)^]
        [^b^rief][^noba^se][all]

    where

    ^variables_and_values^ is an alternating list of variables and either
        numeric values or mean, median, min, max, upper, lower, previous

    ^stat^ is either mean, median, min, max, upper, lower, previous, grmean
        (group mean), grmedian, grmin, grmax

Description
-----------

^prgen1^ computes predicted values for regression models for continuous,
categorical,and count models in a way that is useful for making plots.
Predicted values are computed for the case in which one independent variable
varies over a specified range while the others are held constant.  New
variables are added to the existing dataset that contain these predicted
values that can be plotted.

Note: The new variables will contain data for the first k observations in the
dataset, where k is 11 if not specified with the ncases() option.

Options
-------

^from()^ and ^to()^ specify the values over which varname should vary when
    calculating predicted values.  The defaults are the observed minimum and
    maximum values.

^generate()^ is up to five letters to name the created variables. By changing
     the name you can run -prgen1- repeatedly to compute predictions with
     variables held at various values. It is best to chose a name that is
     different from the beginning letters of variables in your data set.
     This is required.

^ncases^ is the number of predicted values computed as varname varies from
     the start value to the end value. If ^Ncases^ is not specified,
     11 points are generated.

^x()^ sets the values of independent variables for calculating predicted
    values.  The list must alternate variable names and values.  The values
    may be either numeric values or can be mean, median, min, max, previous,
    upper, or lower.  The latter cannot be used if rest() specifies a group
    summary statistic (e.g., grmean).

^rest()^ sets the independent variables not specified in x() to their ^mean^
    (default), ^minimum^, ^maximum^, ^median^ when calculating predicted values.
    ^grmean^ sets these independent variables to the mean conditional on the
    variables and values specified in x(); ^grmedian^, ^grmax^, and ^grmin^ can
    also be used.  If ^prvalue^ has already been run after the last estimate,
    ^previous^ will set unspecified variables to their prior values.  For
    models other than mlogit, ^upper^ and ^lower^ can be used to set independent
    variables to their minimum or maximum depending on which will yield the
    upper or lower extreme predicted value.

^maxcnt()^  The maximum count for which variables are generated for count
    models.  The value must be an integer between 0 and 99; the default is 9.

^all^ specifies that any calculations of means, medians, etc., should use
    the entire sample instead of the sample used to estimate the model.

^brief^ and ^nobase^ suppress the base values of x in the output.

Models and Predictions - * is the prefix
----------------------

all models:

    *X: value of X

    logit & probit:
      Predicted probability of each outcome: *p0, *p1

    ologit, oprobit
        Predicted probabilities: *p#1,*p#2,... where #1,#2,... are values of
            the outcome variable.
        Cumulative probabilities: *s#1,*s#2,... where #1,#2,... are values
            of the outcome variable. *s#k is the probability of all
            categories up to or equal to #k.

    mlogit:
        Predicted probabilities: *p#1,*p#2,... where #1,#2,... are values of
            the outcome variable.

    poisson & nbreg:
        Predicted rate: *mu;
        Predicted probabilities: *p0, *p1... where 0, 1, are counts
        Cumulative probabilities: *s0, *s1... where 0, 1 are counts.
            The cumulative probability of a given count is probability of
            observing count less than or equal to that count.

    regress, tobit, cnreg, intreg
        Predicted xb: *xb

Examples
--------

To compute predicted values from an ordered probit where warm has four
categories SD, D, A and SA:

 . ^oprobit warm yr89 male white age ed prst^
 . ^prgen1 age, f(20) t(80) gen(mn)^
 . ^prgen1 age, x(male=0) rest(grmean) f(20) t(80) gen(fem)^
 . ^prgen1 age, x(male=1) rest(grmean) f(20) t(80) gen(mal)^

To plot the predicted probabilites for average males:

 . ^graph malp1 malp2 malp3 malp4 malX^

.-
Authors: J. Scott Long and Jeremy Freese
         www.indiana.edu/~jslsoc/spost.htm
         spostsup@@indiana.edu


