maTrend | R Documentation |
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.
maTrend(q, n = 300, nam.c, nam.d, simu.c = TRUE)
q |
a object of class of "maBina" estimated from |
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 |
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.
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 |
if |
m1 |
if |
m0 |
if |
trend1 |
if |
trend0 |
if |
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.
Changyou Sun (edwinsun258@gmail.com)
Greene, W.H. 2003. Econometric Analysis (5th ed.). Prentice Hall, New York. 1026 P.
maBina
; print.maTrend
; plot.maTrend
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.