maTrend: Trend of probability values in a binary choice model

View source: R/maTrend.r

maTrendR Documentation

Trend of probability values in a binary choice model

Description

This function computes the change of probability for a continuous variable based on a binary choice model (either probit or logit), and furthermore, stratifies the probability through a binary independant variable.

Usage

maTrend(q, n = 300, nam.c, nam.d, simu.c = TRUE)

Arguments

q

a object of class of "maBina" estimated from maBina().

n

number of points for calculating probability; the large the number, the smoother the curve.

nam.c

a name of a continuous indepedent variable; this must be given for the function to work.

nam.d

an optional name of a binary independent variable; this is used to stratify the probability.

simu.c

Whether simulation data for the continuous variable of nam.c should be used (default is TRUE); if not, the original data for this variable is used.

Details

For a continous variable, its probability values can be computed on the basis of a binary probit or logit model. The trend can be stratified by a binary independent variable. In addition, the standard errors of each probability series are also computed using delta method.

Value

Return a list object of class "maTrend" with the following components:

q

a list object of class "maBina"

nam.c

the name of a continous variable

mm

matrix of independant variables for all

trend

if nam.d is not specified, this is a data frame of the continous variable, its probability values, standard errors, t values, and p values; if nam.d is specified, the data frame contains the continuous variable, the probability values for all, and two additional probability series stratified by the dummy variable

nam.d

if nam.d is specified, the name of a binary variable .

m1

if nam.d is specified, the matrix of mm with the column value for nam.d replaced by 1

m0

if nam.d is specified, the matrix of mm with the column value for nam.d replaced by 0

trend1

if nam.d is specified, this is a data frame reporting the probability value, standard error, t value, and p value associated with the dummy variable being 1

trend0

if nam.d is specified, this is a data frame reporting the probability value, standard error, t value, and p value associated with the dummy variable being 0

Methods

Two methods are defined as follows:

print:

print the probability output.

plot:

Plot the probability values for a continuous variable. If a strata is specified through nam.d in maTrend(), then the stratified values also are shown.

Author(s)

Changyou Sun (edwinsun258@gmail.com)

References

Greene, W.H. 2003. Econometric Analysis (5th ed.). Prentice Hall, New York. 1026 P.

See Also

maBina; print.maTrend; plot.maTrend.

Examples

data(daPe)
ma <- glm(grade ~ gpa + tuce + psi, x = TRUE, 
    data = daPe, family = binomial(link = "probit"))
summary(ma)

(ea <- maBina(w = ma, x.mean = TRUE, rev.dum = TRUE))
(ta <- maTrend(q = ea, nam.c = "gpa", simu.c = FALSE))
(tb <- maTrend(q = ea, nam.c = "gpa", nam.d= "psi", simu.c = TRUE, n=100))
plot(ta)
plot(tb)

erer documentation built on Sept. 26, 2024, 5:06 p.m.