predict.mvoprobit {switchSelection} | R Documentation |
Predict method for mvoprobit function
Description
Predicted values based on object of class 'mvoprobit'.
Usage
## S3 method for class 'mvoprobit'
predict(
object,
...,
newdata = NULL,
given_ind = numeric(),
group = NULL,
group2 = NULL,
type = ifelse(is.null(group2), "prob", "val"),
me = NULL,
eps = NULL,
control = list(),
se = FALSE
)
Arguments
object |
object of class "mvoprobit" |
... |
further arguments (currently ignored) |
newdata |
an optional data frame in which to look for variables with which to predict. If omitted, the original data frame used. This data frame should contain values of dependent variables even if they are not actually needed for prediction (simply assign them with 0 values). |
given_ind |
numeric vector of indexes of conditioned components. |
group |
numeric vector which i-th element represents a value of the i-th dependent variable. If this value equals -1 then this component will be ignored (useful for estimation of marginal probabilities). |
group2 |
numeric vector which i-th element represents a value of the i-th dependent variable of the continuous equation. If this value equals -1 then this component will be ignored. |
type |
string representing a type of prediction. See 'Details' for more information. |
me |
string representing the name of the variable for which marginal effect should be estimated. See 'Details' for more information. |
eps |
numeric vector of length 1 or 2 used for calculation of marginal effects. See 'Details'. |
control |
list of additional arguments. Currently is not intended for the users. |
se |
logical; if |
Details
See 'Examples' section of mvoprobit
for examples of this function application.
If type = "prob"
then function returns a joint probability that
dependent variables will have values assigned in group
. To calculate
marginal probabilities set unnecessary group
values to -1. To
estimate conditional probabilities provide indexes of conditioned variables
through given_ind
. For example if z_{1}
, z_{2}
and
z_{3}
are dependent variables then to calculate
P(z_{1}=2 | z_{3} = 0)
set given_ind = 3
and
groups = c(2, -1, 0)
. Note that conditioning on covariates
(regressors) is omitted for notations brevity and this conditioning depends
on the values in newdata
.
If type = "li"
then function returns a matrix which columns are
linear indexes of corresponding equations.
If type = "sd"
then function returns a matrix which columns are
standard deviations of random errors for corresponding equations.
If type = "li"
or type = "sd"
and some groups
are equal
to -1 then corresponding components will be omitted from the output matrix.
If type = "val"
then function returns predictions of conditional
(on group
) expectation of dependent variable in continuous equations
with regimes determined by group2
argument. To predict unconditional
expectations just set group = NULL
.
If type = "lambda"
then function returns conditional
(on group
) expectations of random error of continuous equation
in regime group2
.
If type = "val"
or type = "lambda"
then output is a matrix
which i
-th column corresponds to prediction associated with
i
-th continuous equation.
If me
is provided then the function returns marginal effect
of variable me
respect to the statistic determined by type
argument.
For example if me = "x1"
and type = "prob"
then function
returns marginal effect of x1
on the corresponding probability
i.e. one that would be estimated if me
is NULL
.
If length(eps) = 1
then eps
is an increment in
numeric differentiation procedure.
If eps
is NULL
then this increment will be selected
automatically taking into account scaling of variables.
If length(eps) = 2
then marginal effects will be estimated as the
difference of predicted value when variable me
equals eps[2]
and eps[1]
correspondingly.
For example suppose that
type = "prob"
, me = "x1"
, given_ind = 3
and
groups = c(2, -1, 0)
. Then if eps
is a NULL
or a
small number (something like eps = 0.0001
) the following marginal
effect will be estimated (via first difference numeric differentiation):
\frac{\partial P(z_{1}=2 | z_{3} = 0)}{\partial x_{1}}.
If eps = c(1, 3)
then the function estimates the following difference
(useful for estimation of marginal effects of ordered covariates):
P(z_{1}=2 | z_{3} = 0, x_{1} = 3) -
P(z_{1}=2 | z_{3} = 0, x_{1} = 1).
Value
This function returns predictions for each row of newdata
or for each observation in the model if newdata
is NULL
.
Structure of the output depends on the type
argument
(see 'Details' section).