mvProbitMargEff {mvProbit} | R Documentation |
Expectations and Marginal Effects from Multivariate Probit Models
Description
mvProbitExp
calculates expected outcomes
from multivariate probit models.
mvProbitMargEff
calculates marginal effects of the explanatory variables
on expected outcomes from multivariate probit models.
The margEff
method for objects of class "mvProbit"
is a wrapper function
that (for the convenience of the user)
extracts the relevant information from the estimation results
and then calls mvProbitMargEff
.
Usage
mvProbitExp( formula, coef, sigma = NULL, data,
cond = FALSE, algorithm = "GHK", nGHK = 1000, random.seed = 123, ... )
mvProbitMargEff( formula, coef, sigma = NULL, vcov = NULL, data,
cond = FALSE, algorithm = "GHK", nGHK = 1000,
eps = 1e-06, dummyVars = NA, addMean = FALSE,
returnJacobian = FALSE, random.seed = 123,
... )
## S3 method for class 'mvProbit'
margEff( object, data = eval( object$call$data ),
cond = FALSE, othDepVar = NULL, dummyVars = object$dummyVars,
atMean = FALSE, calcVCov = FALSE, ... )
Arguments
formula |
a one-sided or two-sided |
coef |
a numeric vector of the model coefficients;
if argument |
sigma |
optional argument for specifying
the covariance/correlation matrix of the residuals
(must be symmetric and have ones on its diagonal);
if this argument is not specified,
the correlation coefficients must be specified by argument |
vcov |
an optional symmetric matrix specifying the variance-covariance matrix of all coefficients (model coefficients and correlation coefficients); if this argument is specified, the approximate variance covariance matrices of the marginal effects are calculated and returned as an attribute (see below). |
data |
a |
cond |
logical value indicating
whether (marginal effects on) conditional expectations (if |
algorithm |
algorithm for computing integrals
of the multivariate normal distribution,
either function |
nGHK |
numeric value specifying the number of simulation draws of the GHK algorithm for computing integrals of the multivariate normal distribution. |
eps |
numeric, the difference between the two values of each (numerical) explanatory variable that is used for the numerical differentiation. |
dummyVars |
optional vector containing the names (character strings)
of explanatory variables
that should be treated as dummy variables (see section ‘Details’).
If |
addMean |
logical.
If |
returnJacobian |
logical.
If |
random.seed |
an integer used to seed R's random number generator;
this is to ensure replicability
when computing (cumulative) probabilities of the multivariate normal distribution
which is required to calculate the conditional expectations;
|
object |
an object of class |
othDepVar |
optional scalar or vector for specifying
the values of the (other) dependent variables
when calculating the marginal effects on the conditional expectations.
If this argument is a scalar (zero or one),
it is assumed that all (other) dependent variables have this value
at all observations.
If this argument is a vector (filled with zeros or ones)
with length equal to the number of dependent variables,
it is assumed that the vector of dependent variables has these values
at all observations.
If this argument is |
atMean |
logical.
If |
calcVCov |
logical.
If |
... |
additional arguments to |
Details
When calculating (marginal effects on) unconditional expectations,
the left-hand side of argument formula
is ignored.
When calculating (marginal effects on) conditional expectations
and argument formula
is a one-sided formula
(i.e. only the right-hand side is specified)
or argument othDepOne
is TRUE
,
(the marginal effects on) the conditional expectations
are calculated based on the assumption
that all other dependent variables are one.
The computation of the marginal effects
of dummy variables
(i.e. variables specified in argument dummyVars
)
ignores argument eps
and evaluates the effect of increasing these variables from zero to one.
The marginal effects of (continuous) variables
(i.e. variables not specified in argument dummyVars
)
are calculated by evaluating the effect
of increasing these variables from their actual values minus 0.5 * eps
to their actual values plus 0.5 * eps
(divided by eps
).
If the model has n
dependent variables (equations)
and k
explanatory variables in each equation,
the order of the model coefficients in argument coef
must be as follows:
b_{1,1}
, ..., b_{1,k}
,
b_{2,1}
, ..., b_{2,k}
, ...,
b_{n,1}
, ..., b_{n,k}
,
where b_{i,j}
is the coefficient
of the j
th explanatory variable in the i
th equation.
If argument sigma
is not specified,
argument coef
must additionally include following elements:
R_{1,2}
, R_{1,3}
, R_{1,4}
, ..., R_{1,n}
,
R_{2,3}
, R_{2,4}
, ..., R_{2,n}
, ...,
R_{n-1,n}
,
where R_{i,j}
is the correlation coefficient corresponding to
the i
th and j
th equation.
If argument vcov
of function mvProbitMargEff
is specified
or argument calcVCov
of the margEff
method is TRUE
,
the approximate variance covariance matrices of the marginal effects
are calculated at each observation by using the ‘delta method’,
where the jacobian matrix of the marginal effects
with respect to the coefficients is obtained by numerical differentiation.
The ‘state’ (or ‘seed’) of R's random number generator
is saved at the beginning of the call to these functions
and restored at the end
so that these functions do not affect the generation
of random numbers outside this function
although the random seed is set to argument random.seed
and the calculation of the (cumulative) multivariate normal distribution
uses random numbers.
Value
mvProbitExp
returns a data frame
containing the expectations of the dependent variables.
mvProbitMargEff
and the margEff
method return a data frame
containing the marginal effects of the explanatory variables
on the expectations of the dependent variables.
If argument vcov
of function mvProbitMargEff
is specified
or argument calcVCov
of the margEff
method is TRUE
,
the returned data frame has an attribute vcov
,
which is a three-dimensional array,
where the first dimension corresponds to the observation
and the latter two dimensions span the approximate variance covariance matrix
of the marginal effects calculated for each observation.
If argument returnJacobian
of function mvProbitMargEff
or method margEff
is set to TRUE
,
the returned data frame has an attribute jacobian
,
which is a three-dimensional array
that contains the Jacobian matrices of the marginal effects
with respect to the coefficients at each observation,
where the first dimension corresponds to the observations,
the second dimension corresponds to the marginal effects,
and the third dimension corresponds to the coefficients.
Author(s)
Arne Henningsen
References
Greene, W.H. (1996): Marginal Effects in the Bivariate Probit Model, NYU Working Paper No. EC-96-11. Available at https://www.ssrn.com/abstract=1293106.
See Also
mvProbit
,
mvProbitLogLik
,
probit
,
glm
Examples
## generate a simulated data set
set.seed( 123 )
# number of observations
nObs <- 10
# generate explanatory variables
xData <- data.frame(
const = rep( 1, nObs ),
x1 = as.numeric( rnorm( nObs ) > 0 ),
x2 = as.numeric( rnorm( nObs ) > 0 ),
x3 = rnorm( nObs ),
x4 = rnorm( nObs ) )
# model coefficients
beta <- c( 0.8, 1.2, -1.0, 1.4, -0.8,
-0.6, 1.0, 0.6, -1.2, -1.6,
0.5, -0.6, -0.7, 1.1, 1.2 )
# covariance matrix of error terms
library( miscTools )
sigma <- symMatrix( c( 1, 0.2, 0.4, 1, -0.1, 1 ) )
# unconditional expectations of dependent variables
yExp <- mvProbitExp( ~ x1 + x2 + x3 + x4, coef = c( beta ),
sigma = sigma, data = xData )
print( yExp )
# marginal effects on unconditional expectations of dependent variables
margEffUnc <- mvProbitMargEff( ~ x1 + x2 + x3 + x4, coef = c( beta ),
sigma = sigma, data = xData )
print( margEffUnc )
# conditional expectations of dependent variables
# (assuming that all other dependent variables are one)
yExpCond <- mvProbitExp( ~ x1 + x2 + x3 + x4, coef = beta,
sigma = sigma, data = xData, cond = TRUE )
print( yExpCond )
# marginal effects on conditional expectations of dependent variables
# (assuming that all other dependent variables are one)
margEffCond <- mvProbitMargEff( ~ x1 + x2 + x3 + x4, coef = beta,
sigma = sigma, data = xData, cond = TRUE )
print( margEffCond )
# conditional expectations of dependent variables
# (assuming that all other dependent variables are zero)
xData$y1 <- 0
xData$y2 <- 0
xData$y3 <- 0
yExpCond0 <- mvProbitExp( cbind( y1, y2, y3 ) ~ x1 + x2 + x3 + x4,
coef = beta, sigma = sigma, data = xData, cond = TRUE )
print( yExpCond0 )
# marginal effects on conditional expectations of dependent variables
# (assuming that all other dependent variables are zero)
margEffCond0 <- mvProbitMargEff( cbind( y1, y2, y3 ) ~ x1 + x2 + x3 + x4,
coef = beta, sigma = sigma, data = xData, cond = TRUE )
print( margEffCond0 )