prediction_margins | R Documentation |
Methods to compute the predictions and the marginal effects for tobit1 objects
## S3 method for class 'tobit1' prediction( model, data = find_data(model, parent.frame()), at = NULL, type = "response", vcov = stats::vcov(model), calculate_se = FALSE, ... ) ## S3 method for class 'tobit1' predict(object, newdata = NULL, what = c("expvalue", "prob", "linpred"), ...)
model, object |
a model fitted using |
data, at, type, vcov, calculate_se |
see |
... |
further arguments, especially, a |
newdata |
a new data frame for which the predict method should compute the predictions |
what |
for the predict method, the kind of predictions, can be
the probabilities ( |
tobit1
exports the prediction::prediction
and
margins::margins
functions. prediction
use the predict
method to compute the predictions in a "tidy way", it returns
the data frame provided for the predictions augmented by the
predictions. margins
compute the average marginal effect of
every covariate. It uses the numerical derivatives of the
predictions using the prediction
function.
prediction
returns a data frame which is a data frame
containging the values of the covariates used for the
predictions augmented by the predicted values. margins
return
an object of class c('margins', 'data.frame')
which is data
frame containg the the marginal effects.
data("feesadm", package = "tobit1") z <- tobit1(fees ~ expense + I(expense ^ 2) + region, feesadm) head(predict(z)) # same with what = "expvalue", the default head(predict(z, what = "expvalue")) # compute the linear predictor and the probability head(predict(z, what = "linpred")) head(predict(z, what = "prob")) # the prediction method returns a data frame prediction(z, what = "prob") # use a smaller data set fees2 <- feesadm[5:25, ] predict(z, newdata = fees2, what = "prob") prediction(z, data = fees2, what = "prob") margins(z, data = fees2, what = "prob") summary(margins(z, data = fees2, what = "prob"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.