Description Usage Arguments Details Value References See Also Examples
Methods for obtaining predictions and residuals from a fitted heteroscedastic probit model object.
1 2 3 4 5 6 |
object |
a fitted object of class inheriting from |
newdata |
optional. A data frame in which to look for variables with which to predict can be supplied. If omitted, the fitted linear predictors are used. |
type |
the type of prediction/residuals required: The default is on the scale of the response, i.e.
probabilities. The alternative |
na.action |
function determining what should be done with missing values in |
... |
currently not used. |
If newdata
is omitted the predictions are based on the data used for fitting.
In addition to the methods above, a set of standard extractor functions for "hetprobit"
objects is available, see hetprobit
for an overview.
A vector of predictions/residuals.
Alvarez R.M. and Brehm J. (1995) American Ambivalence Towards Abortion Policy: Development of a Heteroskedastic Probit Model of Competing Values. American Journal of Political Science, 39(4), 1055–1082.
Greene W.H. (2012) “Econometric Analysis”, Pearson, Prentice Hall, Seventh Edition.
Harvey A.C. (1976) Estimating Regression Models with Multiplicative Heteroscedasticity. Econometrica, 44(3), 461–465.
Keele L.J. and Park D.K. (2006) Ambivalent about Ambivalence: A Re-examination of Heteroskedastic Probit Models. Unpublished manuscript, Penn State University.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## data-generating process
dgp <- function(n = 500, coef = c(0.5, -1.5, 0, 1, 0)) {
d <- data.frame(
x1 = runif(n, -1, 1),
x2 = runif(n, -1, 1)
)
d$ystar <- rnorm(n,
mean = coef[1] + coef[2] * d$x1 + coef[3] * d$x2,
sd = exp(coef[4] * d$x1 + coef[5] * d$x2)
)
d$y <- ifelse(d$ystar > 0, 1, 0)
return(d)
}
## data
set.seed(2017-05-20)
d <- dgp()
## estimate model
m1 <- hetprobit(y ~ x1 + x2, data = d)
## create some new data
nd <- data.frame(x1 = seq(from = -1, to = 5, length.out = 10),
x2 = seq(from = 0.5, to = 5, length.out = 10))
## predicted probabilities (default)
p1 <- predict(m1, newdata = nd)
## predictions on scaled linear predictor
p2 <- predict(m1, newdata = nd, type = "link")
## predictions for scale parameter sigma
p3 <- predict(m1, newdata = nd, type ="scale")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.