Title: | Censored Regression (Tobit) Models |
---|---|
Description: | Maximum Likelihood estimation of censored regression (Tobit) models with cross-sectional and panel data. |
Authors: | Arne Henningsen <[email protected]> |
Maintainer: | Arne Henningsen <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.5-39 |
Built: | 2024-10-17 05:00:54 UTC |
Source: | https://github.com/r-forge/sampleselection |
Fitting a model with a censored dependent variable.
censReg( formula, left = 0, right = Inf, data = sys.frame( sys.parent()), subset = NULL, start = NULL, nGHQ = 8, logLikOnly = FALSE, ... ) ## S3 method for class 'censReg' print( x, logSigma = TRUE, digits = 4, ... )
censReg( formula, left = 0, right = Inf, data = sys.frame( sys.parent()), subset = NULL, start = NULL, nGHQ = 8, logLikOnly = FALSE, ... ) ## S3 method for class 'censReg' print( x, logSigma = TRUE, digits = 4, ... )
formula |
an object of class |
left |
left limit for the censored dependent variable;
if set to |
right |
right limit for the censored dependent variable;
if set to |
data |
an optional data frame.
If argument |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
start |
an optional vector of initial parameters for the ML estimation
(intercept, slope parameters, logarithm of the standard deviation
of the individual effects (only for random-effects panel data models),
and logarithm of the standard deviation of the general disturbance term);
if |
nGHQ |
number of points used in the Gauss-Hermite quadrature, which is used to compute the log-likelihood value in case of the random effects model for panel data. |
logLikOnly |
logical. If |
x |
object of class |
logSigma |
logical value indicating whether the variance(s)
of the model should be printed logarithmized
(see |
digits |
positive integer specifiying the minimum number of
significant digits to be printed
(see |
... |
additional arguments for |
The model is estimated by Maximum Likelihood (ML)
assuming a Gaussian (normal) distribution of the error term.
The maximization of the likelihood function is done
by function maxLik
of the maxLik package.
An additional argument method
can be used to specify
the optimization method used by maxLik
,
e.g.\ "Newton-Raphson"
, "BHHH"
, "BFGS"
,
"SANN"
(for simulated annealing), or
"NM"
(for Nelder-Mead).
If argument logLikOnly
is FALSE
(default),
censReg
returns an object of class "censReg"
inheriting from class "maxLik"
.
The returned object contains the same components as objects
returned by maxLik
and additionally
the following components:
call |
the matched call. |
terms |
the model terms. |
nObs |
a vector containing 4 integer values: the total number of observations, the number of left-censored observations, the number of uncensored observations, and the number of right-censored observations. |
df.residual |
degrees of freedom of the residuals. |
start |
vector of starting values. |
left |
left limit of the censored dependent variable. |
right |
right limit of the censored dependent variable. |
xMean |
vector of mean values of the explanatory variables. |
In contrast,
if argument logLikOnly
is TRUE
,
censReg
returns a vector
of the log-likelihood contributions of all observations/individuals.
This vector has an attribute "gradient"
,
which is a matrix containing the gradients of the log-likelihood contributions
with respect to the parameters.
When the censored regression model is estimated, the log-likelihood function is maximized with respect to the coefficients and the logarithm(s) of the variance(s).
Arne Henningsen
Greene, W.H. (2008): Econometric Analysis, Sixth Edition, Prentice Hall, p. 871-875.
Kleiber, C. and Zeileis, A. (2008): Applied Econometrics with R, Springer, p. 141-143.
Tobin, J. (1958): Estimation of Relationships for Limited Dependent Variables. Econometrica 26, p. 24-36.
summary.censReg
, coef.censReg
,
tobit
, selection
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) print( estResult ) ## Kleiber & Zeileis ( 2008 ), page 143 estResultBoth <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs, right = 4 ) print( estResultBoth )
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) print( estResult ) ## Kleiber & Zeileis ( 2008 ), page 143 estResultBoth <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs, right = 4 ) print( estResultBoth )
These functions extract the coefficient vectors, the corresponding covariance matrices, and log-likelihood values from censored regression models.
## S3 method for class 'censReg' coef( object, logSigma = TRUE, ... ) ## S3 method for class 'censReg' vcov( object, logSigma = TRUE, ... ) ## S3 method for class 'censReg' logLik( object, ... )
## S3 method for class 'censReg' coef( object, logSigma = TRUE, ... ) ## S3 method for class 'censReg' vcov( object, logSigma = TRUE, ... ) ## S3 method for class 'censReg' logLik( object, ... )
object |
object of class |
logSigma |
logical value indicating whether the variance(s) of the model should be returned logarithmized. |
... |
currently not used. |
coef.censReg
returns a vector of the estimated coefficients.
vcov.censReg
returns the covariance matrix
of the estimated coefficients.
logLik.censReg
returns an object of class "logLik"
.
This object is the log-likelihood value of the estimated model
and has an attribute "df"
that gives the degrees of freedom,
i.e.\ the number of estimated parameters.
When the censored regression model is estimated,
the log-likelihood function is maximized with respect
to the coefficients and the logarithm(s)
of the variance(s).
Hence, if argument logSigma
is FALSE
,
the variance(s) of the model is/are calculated by applying
the exponential function to the estimated logarithmized variance(s)
and the covariance matrix of all parameters is calculated
by the Delta method.
Arne Henningsen
censReg
, summary.censReg
,
and coef.summary.censReg
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) coef( estResult ) coef( estResult, logSigma = FALSE ) vcov( estResult ) vcov( estResult, logSigma = FALSE ) logLik( estResult )
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) coef( estResult ) coef( estResult, logSigma = FALSE ) vcov( estResult ) vcov( estResult, logSigma = FALSE ) logLik( estResult )
This function returns the estimated coefficients of censored regression models as well as their standard errors, z-values, and P-values.
## S3 method for class 'summary.censReg' coef( object, logSigma = TRUE, ... )
## S3 method for class 'summary.censReg' coef( object, logSigma = TRUE, ... )
object |
object of class |
logSigma |
logical value indicating whether the variance(s) of the model should be returned logarithmized. |
... |
currently not used. |
coef.summary.censReg
returns an matrix,
where each row corresponds to one coefficient
and the 4 rows contain the estimated coefficients,
their standard errors, z-values, and P-values.
Arne Henningsen
censReg
, summary.censReg
and
coef.censReg
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) coef( summary( estResult ) )
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) coef( summary( estResult ) )
The margEff
method computes the marginal effects of the explanatory variables
on the expected value of the dependent variable evaluated.
Please note that this functionality is currently not available
for panel data models.
## S3 method for class 'censReg' margEff( object, xValues = NULL, vcov = NULL, calcVCov = TRUE, returnJacobian = FALSE, vcovLogSigma = TRUE, ... ) ## S3 method for class 'margEff.censReg' summary( object, ... )
## S3 method for class 'censReg' margEff( object, xValues = NULL, vcov = NULL, calcVCov = TRUE, returnJacobian = FALSE, vcovLogSigma = TRUE, ... ) ## S3 method for class 'margEff.censReg' summary( object, ... )
object |
argument |
xValues |
vector that specifies the values of the explanatory variables
(including the intercept if it is included in the model),
at which the marginal effects should be calculated.
The number and order of the elements of this vector
must correspond to the number and order of the estimated coefficients
(without sigma).
If this argument is |
vcov |
a symmetric matrix that specifies the variance covariance
matrix of the estimated coefficients
that should be used to calculate the variance covariance matrix
and the standard errors of the marginal effects.
If this argument is |
calcVCov |
logical. If |
returnJacobian |
logical. If |
vcovLogSigma |
logical. |
... |
currently not used. |
margEff.censReg
returns an object of class "margEff.censReg"
,
which is a vector of the marginal effects of the explanatory variables
on the expected value of the dependent variable evaluated
at the mean values of the explanatory variables.
The returned object has an attribute df.residual
,
which is equal to the degrees of freedom of the residuals.
If argument calcVCov
is TRUE
,
the object returned by margEff.censReg
has an attribute vcov
,
which is a the approximate variance covariance matrices
of the marginal effects calculated
with the Delta method.
If argument returnJacobian
is TRUE
,
the object returned by margEff.censReg
has an attribute jacobian
,
which is the Jacobian of the marginal effects
with respect to the coefficients.
summary.margEff.censReg
returns
an object of class "summary.margEff.censReg"
,
which is a matrix with four columns,
where the first column contains the marginal effects,
the second column contains the standard errors of the marginal effects,
the third column contains the corresponding t-values,
and the fourth columns contains the corresponding P values.
Arne Henningsen
censReg
, coef.censReg
,
and summary.censReg
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) margEff( estResult ) summary( margEff( estResult ) ) margEff( estResult, xValues = c( 1, 40, 4, 2, 4, 4 ) )
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) margEff( estResult ) summary( margEff( estResult ) ) margEff( estResult, xValues = c( 1, 40, 4, 2, 4, 4 ) )
These methods prepare and print summary results for censored regression models.
## S3 method for class 'censReg' summary( object, ... ) ## S3 method for class 'summary.censReg' print( x, logSigma = TRUE, digits = 4, ... )
## S3 method for class 'censReg' summary( object, ... ) ## S3 method for class 'summary.censReg' print( x, logSigma = TRUE, digits = 4, ... )
object |
object of class |
x |
object of class |
logSigma |
logical value indicating whether the variance(s) of the model should be printed logarithmized. |
digits |
positive integer specifiying the minimum number of
significant digits to be printed
(passed to |
... |
currently not used. |
summary.censReg
returns an object of class "summary.censReg"
inheriting from class "summary.maxLik"
.
The returned object contains the same components as objects
returned by summary.maxLik
and additionally
the following components:
call |
the matched call. |
nObs |
a vector containing 4 integer values: the total number of observations, the number of left-censored observations, the number of uncensored observations, and the number of right-censored observations. |
Arne Henningsen
censReg
, coef.summary.censReg
,
and coef.censReg
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) summary( estResult )
## Kleiber & Zeileis ( 2008 ), page 142 data( "Affairs", package = "AER" ) estResult <- censReg( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs ) summary( estResult )