Description Usage Arguments Details Value References See Also Examples
Fitting heteroscedastic probit models via maximum likelihood.
1 2 3 4 5 6 | hetprobit2(formula, data, subset, na.action, model = TRUE, y = TRUE, x = FALSE, control = hetprobit2_control(...), ...)
hetprobit2_fit(x, y, z = NULL, control, ...)
hetprobit2_control(maxit = 5000, start = NULL, ...)
|
formula |
FIXME |
data |
FIXME |
subset |
FIXME |
na.action |
FIXME |
model |
FIXME |
x, y |
FIXME |
z |
FIXME |
... |
FIXME |
control, maxit, start |
FIXME |
FIXME
An object of class "hetprobit2"
.
FIXME
FIXME
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 | ## packages
require("glmx")
## data-generating process
dgp <- function(n = 100, coef = c(1, 1, -1, 0, 1, 0)) {
d <- data.frame(
x1 = runif(n, -1, 1),
x2 = runif(n, -1, 1)
)
d$ystar <- rnorm(100,
mean = coef[1] + coef[2] * d$x1 + coef[3] * d$x2,
sd = exp(coef[4] + coef[5] * d$x1 + coef[6] * d$x2)
)
d$y <- ifelse(d$ystar > 0, 1, 0)
return(d)
}
## data
set.seed(2017-05-20)
d <- dgp()
## ## model fitting (m0 with hetglm.fit from glmx package, m1 with hetprobit2 function)
m0 <- hetglm(y ~ x1 + x2, data = d)
m1 <- hetprobit2(y ~ x1 + x2, data = d)
## comparison of coefficients
cbind(coef(m0), coef(m1))
## comparison of log-Likelihoods
cbind(logLik(m0), logLik(m1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.