Fit a collection of parametric unit quantile regression model
by maximum likelihood using the log-likelihood function, the score vector
and the hessian matrix implemented in C++.
Usage
unitquantreg(
formula,
data,
subset,
na.action,
tau,
family,
link = c("logit", "probit", "cloglog", "cauchit"),
link.theta = c("identity", "log", "sqrt"),
start = NULL,
control = unitquantreg.control(),
model = TRUE,
x = FALSE,
y = TRUE
)
unitquantreg.fit(
y,
X,
Z = NULL,
tau,
family,
link,
link.theta,
start = NULL,
control = unitquantreg.control()
)Arguments
- formula
symbolic description of the quantile model like
y ~ xory ~ x | z. See below for details.- data
data.frame contain the variables in the model.
- subset
an optional vector specifying a subset of observations to be used in the fitting process.
- na.action
a function which indicates what should happen when the data contain
NAs.- tau
numeric vector. The quantile(s) to be estimated, i.e., number between 0 and 1. If just one quantile is specified an object of class
unitquantregis returned. If a numeric vector of values between 0 and 1 is specified an object of classunitquantregsis returned. See below for details.- family
character. Specify the distribution family.
- link
character. Specify the link function in the quantile model. Currently supported are
logit,probit,cloglogandcauchit. Default islogit.- link.theta
character. Specify the link function in the shape model. Currently supported are
identity,logandsqrt. Default islog.- start
numeric vector. An optional vector with starting values for all parameters.
- control
list. Control arguments specified via
unitquantreg.control.- model
logical. Indicates whether model frame should be included as a component of the returned value.
- x, y
logical. If
TRUEthe corresponding components of the fit (model frame, response, model matrix) are returned. Forunitquantreg.fityshould be the numeric response vector with values in (0,1).- X, Z
numeric matrix. Regressor matrix for the quantile and shape model, respectively. Default is constant shape model, i.e.,
Zis matrix with column of ones.
Value
unitquantreg can return an object of
class unitquantreg if tau is a scalar, i.e., a list with
the following components.
- family
the distribution family name.
- coefficients
a list with elements
"quantile"and"shape"containing the coefficients from the respective models.- fitted.values
a list with elements
"quantile"and"shape"containing the fitted parameters from the respective models.- linear.predictors
a list with elements
"quantile"and"shape"containing the fitted linear predictors from the respective models.- link
a list with elements
"quantile"and"shape"containing the link objects from the respective models.- tau
the quantile specify.
- loglik
log-likelihood of the fitted model.
- gradient
gradient evaluate at maximum likelihood estimates.
- vcov
covariance matrix of all parameters in the model.
- nobs
number of observations.
- npar
number of parameters.
- df.residual
residual degrees of freedom in the fitted model.
- theta_const
logical indicating if the \(\theta\) parameter was treated as nuisance parameter.
- control
the control parameters used to fit the model.
- iterations
number of iterations of optimization method.
- converged
logical, if
TRUEindicates successful convergence.- kkt
a list of logical
kkt1andkkt2provide check on Kuhn-Karush-Tucker conditions, first-order KKT test (kkt1) checks whether the gradient at the final parameters estimates is "small" and the second-order KKT test (kkte) checks whether the Hessian at the final parameters estimates is positive definite.- elapsed_time
time elapsed to fit the model.
- call
the original function call.
- formula
the original model formula.
- terms
a list with elements
"quantile","shape"and"full"containing thetermsobjects for the respective models.- model
the full model frame, if
model = TRUE.- y
the response vector, if
y = TRUE.- x
a list with elements
"quantile"and"shape"containing the model matrices from the respective models, ifx = TRUE.
While unitquantreg.fit returns an unclassed list with
components up to elapsed_time.
If tau is a numeric vector with length greater than one an object of
class unitquantregs is returned, which consist of list of objects of
class unitquantreg for each specified quantiles.
Details
The parameter estimation and inference are performed under the frequentist paradigm.
The optimx R package is use, since allows different optimization
technique to maximize the log-likelihood function. The analytical score function are
use in the maximization and the standard errors are computed using the
analytical hessian matrix, both are implemented in efficient away using C++.