| fetobit {capybara} | R Documentation |
Tobit model fitting with high-dimensional k-way fixed effects
Description
A wrapper for feglm with family = "tobit".
This fits a censored regression model where outcomes below tobit_lb
or above tobit_ub are treated as censored. The censoring bounds
are specified via the control argument.
Usage
fetobit(
formula = NULL,
data = NULL,
weights = NULL,
vcov = NULL,
beta_start = NULL,
eta_start = NULL,
offset = NULL,
tobit_lb = -Inf,
tobit_ub = Inf,
control = NULL
)
Arguments
formula |
an object of class "formula": a symbolic description of the model to be fitted. formula
must be of type response ~ slopes | fixed_effects | cluster.
|
data |
an object of class "data.frame" containing the variables in the model. The expected input is a
dataset with the variables specified in formula and a number of rows at least equal to the number of variables
in the model.
|
weights |
an optional string with the name of the prior weights variable in data.
|
vcov |
an optional character string specifying the type of variance-covariance estimator.
One of "iid" (default OLS, ignore cluster part of formula), "hetero" (heteroskedastic-robust
HC0, computed in C++ - no cluster variable needed), "cluster" (one-way sandwich using the cluster
variable in the formula), "m-estimator" (M-estimator one-way sandwich), or "dyadic"
(Cameron-Miller dyadic sandwich; requires two entity variables in the third part of the formula).
When NULL (default), the type is inferred from the formula: if a cluster variable is present the
standard sandwich is used, otherwise the inverse Hessian (IID) is returned.
|
beta_start |
an optional vector of starting values for the structural parameters in the linear predictor.
Default is \boldsymbol{\beta} = \mathbf{0}.
|
eta_start |
an optional vector of starting values for the linear predictor. |
offset |
an optional formula or numeric vector specifying an a priori known component to be included in the
linear predictor. If a formula, it should be of the form ~ variable.
|
tobit_lb |
numeric indicating the lower censoring bound. Observations with
y <= tobit_lb are treated as left-censored. Default is -Inf (no left censoring).
|
tobit_ub |
numeric indicating the upper censoring bound. Observations with
y >= tobit_ub are treated as right-censored. Default is Inf (no right censoring).
|
control |
a named list of parameters for controlling the fitting process. See fit_control for details. |
Value
A named list of class "feglm".
See Also
fit_control for additional control parameters
Examples
# Left-censored at 0 (Type I Tobit)
d <- data.frame(
y = pmax(0, rnorm(100, 2, 1)),
x = rnorm(100),
g = factor(rep(1:5, 20))
)
mod <- fetobit(y ~ x | g, d, tobit_lb = 0)
summary(mod)
# Two-sided censoring
d2 <- data.frame(
y = pmin(pmax(rnorm(100, 5, 2), 0), 10),
x = rnorm(100),
g = factor(rep(1:5, 20))
)
mod2 <- fetobit(y ~ x | g, d2, tobit_lb = 0, tobit_ub = 10)
summary(mod2)