crch

0th

Percentile

Censored Regression with Conditional Heteroscedasticy

Fitting censored (tobit) or truncated regression models with conditional heteroscedasticy.

Keywords
regression
Usage
crch(formula, data, subset, na.action, weights, offset, 
  link.scale = c("log", "identity", "quadratic"),
  dist = c("gaussian", "logistic", "student"), df = NULL, 
  left = -Inf, right = Inf, truncated = FALSE, 
  type = c("ml", "crps"), control = crch.control(…), 
  model = TRUE, x = FALSE, y = FALSE, …)

trch(formula, data, subset, na.action, weights, offset, link.scale = c("log", "identity", "quadratic"), dist = c("gaussian", "logistic", "student"), df = NULL, left = -Inf, right = Inf, truncated = TRUE, type = c("ml", "crps"), control = crch.control(…), model = TRUE, x = FALSE, y = FALSE, …)

crch.fit(x, z, y, left, right, truncated = FALSE, dist = "gaussian", df = NULL, link.scale = "log", type = "ml", weights = NULL, offset = NULL, control = crch.control())

Arguments
formula

a formula expression of the form y ~ x | z where y is the response and x and z are regressor variables for the location and the scale of the fitted distribution respectively.

data

an optional data frame containing the variables occurring in the formulas.

subset

an optional vector specifying a subset of observations to be used for fitting.

na.action

a function which indicates what should happen when the data contain NAs.

weights

optional case weights in fitting.

offset

optional numeric vector with a priori known component to be included in the linear predictor for the location. For crch.fit, offset can also be a list of 2 offsets used for the location and scale respectively.

link.scale

character specification of the link function in the scale model. Currently, "identity", "log", "quadratic" are supported. The default is "log". Alternatively, an object of class "link-glm" can be supplied.

dist

assumed distribution for the dependent variable y.

df

optional degrees of freedom for dist="student". If omitted the degrees of freedom are estimated.

left

left limit for the censored dependent variable y. If set to -Inf, y is assumed not to be left-censored.

right

right limit for the censored dependent variable y. If set to Inf, y is assumed not to be right-censored.

truncated

logical. If TRUE truncated model is fitted with left and right interpreted as truncation points, If FALSE censored model is fitted. Default is FALSE

type

loss function to be optimized. Can be either "ml" for maximum likelihood (default) or "crps" for minimum continuous ranked probability score (CRPS).

control

a list of control parameters passed to optim or to the internal boosting algorithm if control=crch.boost(). Default is crch.control().

model

logical. If TRUE model frame is included as a component of the returned value.

x, y

for crch: logical. If TRUE the model matrix and response vector used for fitting are returned as components of the returned value. for crch.fit: x is a design matrix with regressors for the location and y is a vector of observations.

z

a design matrix with regressors for the scale.

arguments to be used to form the default control argument if it is not supplied directly.

Details

crch fits censored (tobit) or truncated regression models with conditional heteroscedasticy with maximum likelihood estimation. Student-t, Gaussian, and logistic distributions can be fitted to left- and/or right censored or truncated responses. Different regressors can be used to model the location and the scale of this distribution. If control=crch.boost() optimization is performed by boosting.

trch is a wrapper function for crch with default truncated = TRUE.

crch.fit is the lower level function where the actual fitting takes place.

Value

An object of class "crch" or "crch.boost", i.e., a list with the following elements.

coefficients

list of coefficients for location, scale, and df. Scale and df coefficients are in log-scale.

df

if dist = "student": degrees of freedom of student-t distribution. else NULL.

residuals

the residuals, that is response minus fitted values.

fitted.values

list of fitted location and scale parameters.

dist

assumed distribution for the dependent variable y.

cens

list of censoring points.

optim

output from optimization from optim.

method

optimization method used for optim.

type

used loss function (maximum likelihood or minimum CRPS).

control

list of control parameters passed to optim

start

starting values of coefficients used in the optimization.

weights

case weights used for fitting.

offset

list of offsets for location and scale.

n

number of observations.

nobs

number of observations with non-zero weights.

loglik

log-likelihood.

vcov

covariance matrix.

link

a list with element "scale" containing the link objects for the scale model.

truncated

logical indicating wheter a truncated model has been fitted.

converged

logical variable whether optimization has converged or not.

iterations

number of iterations in optimization.

call

function call.

formula

the formula supplied.

terms

the terms objects used.

levels

list of levels of the factors used in fitting for location and scale respectively.

contrasts

(where relevant) the contrasts used.

y

if requested, the response used.

x

if requested, the model matrix used.

model

if requested, the model frame used.

stepsize, mstop, mstopopt, standardize

return values of boosting optimization. See crch.boost for details.

References

Messner JW, Mayr GJ, Zeileis A (2016). Heteroscedastic Censored and Truncated Regression with crch. The R Journal, 3(1), 173--181. https://journal.R-project.org/archive/2016-1/messner-mayr-zeileis.pdf.

Messner JW, Zeileis A, Broecker J, Mayr GJ (2014). Probabilistic Wind Power Forecasts with an Inverse Power Curve Transformation and Censored Regression. Wind Energy, 17(11), 1753--1766. 10.1002/we.1666.

See Also

predict.crch, crch.control, crch.boost

Aliases
  • crch
  • trch
  • crch.fit
Examples
# NOT RUN {
data("RainIbk")
## mean and standard deviation of square root transformed ensemble forecasts
RainIbk$sqrtensmean <- 
  apply(sqrt(RainIbk[,grep('^rainfc',names(RainIbk))]), 1, mean)
RainIbk$sqrtenssd <- 
  apply(sqrt(RainIbk[,grep('^rainfc',names(RainIbk))]), 1, sd)

## fit linear regression model with Gaussian distribution 
CRCH <- crch(sqrt(rain) ~ sqrtensmean, data = RainIbk, dist = "gaussian")
## same as lm?
all.equal(coef(lm(sqrt(rain) ~ sqrtensmean, data = RainIbk)),
  head(coef(CRCH), -1), tolerance = .Machine$double.eps^0.25)

## print
CRCH
## summary
summary(CRCH)

## left censored regression model with censoring point 0:
CRCH2 <- crch(sqrt(rain) ~ sqrtensmean, data = RainIbk, 
  dist = "gaussian", left = 0)

## left censored regression model with censoring point 0 and 
## conditional heteroscedasticy:
CRCH3 <- crch(sqrt(rain) ~ sqrtensmean|sqrtenssd, data = RainIbk, 
  dist = "gaussian",  left = 0)

## left censored regression model with censoring point 0 and 
## conditional heteroscedasticy with logistic distribution:
CRCH4 <- crch(sqrt(rain) ~ sqrtensmean|sqrtenssd, data = RainIbk, 
  dist = "logistic", left = 0)

## compare AIC 
AIC(CRCH, CRCH2, CRCH3, CRCH4)
# }
Documentation reproduced from package crch, version 1.0-4, License: GPL-2 | GPL-3

Community examples

Looks like there are no examples yet.