censReg: Censored Data Regression

View source: R/censReg.R

censRegR Documentation

Censored Data Regression

Description

Builds a linear regression model for censored response data.

Usage

censReg(formula, data, subset, weights, na.action, dist = "normal")

Arguments

formula

a formula describing the regression model. See Details.

data

the data to search for the variables in formula.

subset

an expression to select a subset of the data.

weights

a variable to use for weights.

na.action

what to do with missing values.

dist

the distribution of the data, either "normal," "lognormal," or "commonlog." See Details.

Details

The left-hand side of the formula may be any numeric variable, just as with lm or a variable of class "lcens," "mcens," or "qw."
For un- or left-censored data, AMLE is used unless weights are specified in the model, then MLE is used, through a call to survreg. For any other censored data, MLE is used.
If dist is "normal," then the regression analysis assumes that the residuals are normally distributed. If dist is "lognormal," then the regression analysis assumes that the residuals are lognormally distributed. In this case, predicted values are back transformed and optionally bias corrected to represent the expected mean. If dist is "commonlog," then the response data are transformed using log10 and those residuals are assumed to be normally distributed. No back transformation is made for predicted values.

Value

An object of class "censReg."

Note

A special feature of censReg is the ability to expand the formula passed as a variable rather than as an expressly entered formula. This feature is intended to facilitate certain kinds of scripts that construct a formula from combinations of variables in a dataset.

Objects of class "censReg" have these methods:

coef

extract the regression coefficents

extractAIC

compute another information criterion (AIC) value

fitted

extract the fitted values

logLik

compute the log-likelihood of the fitted model

nobs

extract the number of observations used to fit the model

plot

create some basic diagnostic plots

predict

predict new values from the model

print

print the model

residuals

extract the residuals from the model

rmse

compute the root mean squared error (residual standard error)

summary

compute summary information about the model

vcov

extract the variance-covariance matrix from the model

vif

compute the variance inflation factors for the explanatory variables in the model

The AMLE method has arbitrary limitations on the size of the data: 24 explanatory variables and 5000 observations. Exceeding these will generate a warning message with the error code in the output object.

References

Lorenz, 2015, smwrQW.
Breen, R., 1996, Regression models: censored, sample selected, or truncated data: Sage University Paper series on Quantitative Applications in the Social Sciences, 07-111, Thousand Oaks, CA,
Cohn, T.A., 1988, Adjusted maximum likelihood estimation of moments of lognormal populations from type I censored samples: U.S. Geological Survey Open-File Report 88-350, 34 p.

See Also

lm, survreg

Examples


set.seed(345)
X <- runif(24, 1, 5)
Y <- X/2 + rnorm(24)
lm(Y ~ X) # the uncensored regression
censReg(as.lcens(Y, 1) ~ X) # censored at 1


USGS-R/smwrQW documentation built on Oct. 11, 2022, 6:13 a.m.