Description Usage Arguments Value Examples
Note, this is a simple frequentist prediction and does not account for estimation uncertainty. If one wants to account for estimation uncertainty it is reccomended to use the Bayesian philosophy.
1 2 3 |
object |
a object of class |
newdata |
a matrix of column dimension k1 + k2 where the first k1 columns correspond to the predictors of the first equations and the second k2 columns correspond to predictors of the second equation. If intercepts were used they need to be explicitly input. |
mRule |
a vector of length 1 or 2. This is the marginal decision rule
for classifying the outcomes for stages 1 and 2. Stage 1 is
classified as 1 if the probability of stage 1 being 1 is greater
than or equal to |
jRule |
an optional numerical value between 0 and 1. If specified
then the observable outcome (both stages being 1) is 1 if the joint
probability of both stages being 1 is greater than jRule. If jRule
is unspecified or set to |
... |
unused |
method predict.fBiProbitPArtial
returns a data.frame with columns
Predicted mean of the first stage latent outcome
Predicted mean of the second stage latent outcome
Probability the outcome of the first stage is 1
Probability the outcome of the second stage is 1
Probability the outcome of both stages is 0
Probability the outcome of the first stage is 0 and the second stage is 1
Probability the outcome of stage 1 is 1 and stage 2 is 0
Probability the outcome of both stages are 1
Classification of the outcome for stage 1. This value
is 1 if p1 >= mRule[1]
and 0 else
Classification of the outcome for stage 2. This value
is 1 if p2 >= mRule[2]
and 0 else
Classification of the observable outcome.
If jRule
is specified then this value is 1 if p12 >= jRule
and 0 else. If jRule
is unspecified then this value is the element-wise product of
yHat1 and yHat2.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##
# Perform a prediction with the same covariates the model is estimated with
##
data('Mroz87',package = 'sampleSelection')
Mroz87$Z = Mroz87$lfp*(Mroz87$wage >= 5)
f1 = BiProbitPartial(Z ~ educ + age + kids5 + kids618 + nwifeinc | educ + exper + city,
data = Mroz87, philosophy = "frequentist")
library(Formula)
eqn = Formula::Formula( ~ educ + age + kids5 + kids618 + nwifeinc | educ + exper + city)
matrix1 = model.matrix(eqn, lhs = 0, rhs=1, data= Mroz87)
matrix2 = model.matrix(eqn, lhs = 0, rhs=2, data= Mroz87)
newdat = cbind(matrix1,matrix2)
preds1 = predict(f1,newdat)
head(preds1)
preds2 = predict(f1,newdat, jRule = .25)
# Compare predicted outcome with realized outcome
head(cbind(Mroz87$Z,preds1$ZHat,preds2$ZHat),20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.