regressCensTra

regressCensTra computes signed sqrt LR test for lambda in the censored (Tobit) model

Syntax

  • out=regressCensTra(y,X)example
  • out=regressCensTra(y,X,Name,Value)example

Description

This routines estimates the regression coefficients, sigma and the trasformation parameter lambda. The model is estimated by Maximum Likelihood (ML) assuming a Gaussian (normal) distribution of the error term in the transformed scale. The maximization of the likelihood function is done by function fmincon of the optimization toolbox.

It also computes the signed sqrt likelihood ratio test of $H_0:\lambda=\lambda_0$.

example

out =regressCensTra(y, X) Tobit regression using the affairs dataset.

example

out =regressCensTra(y, X, Name, Value) Example of right censoring.

Examples

expand all

  • Tobit regression using the affairs dataset.
  • In the example of Kleiber and Zeileis (2008, p. 142), the number of a person's extramarital sexual inter-courses ("affairs") in the past year is regressed on the person's age, number of years married, religiousness, occupation, and won rating of the marriage. The dependent variable is left-censored at zero and not right-censored.

    % We show below the estimates of lambda, beta, sigma and transformation
    % parameter lambda
    load affairs.mat
    X=affairs(:,["age" "yearsmarried" "religiousness" "occupation" "rating"]);
    y=affairs(:,"affairs");
    out=regressCensTra(y,X,"dispresults",true);
    Observations:
        Total    LeftCensored    Uncensored    RightCensored
        _____    ____________    __________    _____________
    
         601         451            150              0      
    
    Coefficients
                         betaout     sebetaout     tout         pval   
                         ________    _________    _______    __________
    
        (Intercept)        8.0994      2.0551      3.9411    9.0766e-05
        age              -0.17896    0.096378     -1.8568       0.06383
        yearsmarried      0.55581     0.19968      2.7835     0.0055481
        religiousness      -1.687      0.2857     -5.9047    5.9462e-09
        occupation        0.32197     0.25833      1.2464       0.21313
        rating            -2.2832     0.42998     -5.3102    1.5499e-07
        sigma              8.2092      0.7192      11.414    2.0181e-27
        lambda             1.2595     0.20391      6.1769    1.2131e-09
    
    Number of observations: 601, Error degrees of freedom:594
    Log-likelihood: -703.2104
    R-squared: 0.36215
    

  • Example of right censoring.
  • When left=-Inf and right=0 indicates that there is no left-censoring but there is a right censoring at 0. The same model as above but with the negative number of affairs as the dependent variable can be estimated by

    load affairs.mat
    X=affairs(:,["age" "yearsmarried" "religiousness" "occupation" "rating"]);
    y=affairs(:,"affairs").*(-1);
    out=regressCensTra(y,X,"dispresults",true,"left",-Inf,"right",0);
    % This estimation does not return anymore beta parameters that have the opposite sign of
    % the beta parameters in the original model, because of lambda

    Related Examples

    expand all

  • Example of right censoring with X a table with categorical variables.
  • When left=-Inf and right=0 indicates that there is no left-censoring but there is a right censoring at 0. The same model as above but with the negative number of affairs as the dependent variable can be estimated by

    load affairs.mat
    X=affairs(:,["age" "yearsmarried" "religiousness" "occupation" "rating"]);
    y=affairs(:,"affairs").*(-1);
    out=regressCensTra(y,X,"dispresults",true,"left",-Inf,"right",0);

  • Another example with right censoring.
  • This example is taken from https://stats.oarc.ucla.edu/r/dae/tobit-models/ Consider the situation in which we have a measure of academic aptitude (scaled 200-800) which we want to model using reading and math test scores, as well as, the type of program the student is enrolled in (academic, general, or vocational). The problem here is that students who answer all questions on the academic aptitude test correctly receive a score of 800, even though it is likely that these students are not “truly” equal in aptitude. The same is true of students who answer all of the questions incorrectly. All such students would have a score of 200, although they may not all be of equal aptitude.

    XX=readtable("https://stats.idre.ucla.edu/stat/data/tobit.csv","ReadRowNames",true);
    XX.prog=categorical(XX.prog);
    % The dataset contains 200 observations. The academic aptitude variable is
    % "apt", the reading and math test scores are read and math respectively. The
    % variable prog is the type of program the student is in, it is a
    % categorical (nominal) variable that takes on three values, academic
    % general, and vocational (prog = 3). 
    % The scatterplot matrix is shown below
    spmplot(XX(:,[1 2 4]));
    % Now let’s look at the data descriptively. Note that in this dataset, the
    % lowest value of apt is 352. That is, no students received a score of 200
    % (the lowest score possible), meaning that even though censoring from
    % below was possible, it does not occur in the dataset.
    summary(XX)
    % Define y and X
    y=XX(:,"apt");
    X=XX(:,["read", "math" "prog"]);
    % Call regressCens
    out=regressCensTra(y,X,'right',800,'left',-Inf,'dispresults',true);
    disp('Value of the signed sqrt lik ratio test')
    disp(out.signLR)

    Input Arguments

    expand all

    y — Response variable. Vector.

    Response variable, specified as a vector of length n, where n is the number of observations. Each entry in y is the response for the corresponding row of X.

    Data Types: array or table

    X — Predictor variables in the regression equation. Matrix.

    Matrix of explanatory variables (also called 'regressors') of dimension n x (p-1) where p denotes the number of explanatory variables including the intercept. Rows of X represent observations, and columns represent variables. By default, there is a constant term in the model, unless you explicitly remove it using input option intercept, so do not include a column of 1s in X. Missing values (NaN's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations.

    Data Types: array or table

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'bsb',[3 5 20:30] , 'dispresults',true , 'left',1 , 'initialbeta',[3 8] , 'initialbeta',[3 8] , 'intercept',false , 'la0',0.5 , 'nocheck',false , 'right',800 ,'optmin.Display','off'

    bsb —units forming subset.vector.

    m x 1 vector of integers or logical vector of length n.

    The default value of bsb is 1:n, that is all units are used to compute parameter estimates.

    Example: 'bsb',[3 5 20:30]

    Data Types: double or logical vector

    dispresults —Display results of final fit.boolean.

    If dispresults is true, labels of coefficients, estimated coefficients, standard errors, tstat and p-values are shown on the screen in a fully formatted way. The default value of dispresults is false.

    Example: 'dispresults',true

    Data Types: logical

    left —left limit for the censored dependent variable.scalar.

    If set to -Inf, the dependent variable is assumed to be not left-censored; default value of left is zero (classical Tobit model).

    Example: 'left',1

    Data Types: double

    initialbeta —initial estimate of beta.vector.

    (p-1) x 1 vector. If initialbeta is not supplied (default) standard least squares is used to find initial estimate of beta

    Example: 'initialbeta',[3 8]

    Data Types: double

    initialla —initial estimate of lambda.scalar.

    Initial value of the transformation parameter which has to be used in the optimization procedure

    Example: 'initialbeta',[3 8]

    Data Types: double

    intercept —Indicator for constant term.true (default) | false.

    Indicator for the constant term (intercept) in the fit, specified as the comma-separated pair consisting of 'Intercept' and either true to include or false to remove the constant term from the model.

    Example: 'intercept',false

    Data Types: boolean

    la0 —Transformation parameter to test.scalar.

    Value of the transformation parameter which has to be tested using the signed sqrt root lik ratio test. The default value is la0 is 1. For example to test log transformation use la0=0. The family of transformations which is used is Yeo and Johnson.

    Example: 'la0',0.5

    Data Types: double

    nocheck —Check input arguments.boolean.

    If nocheck is equal to true no check is performed on supplied structure model

    Example: 'nocheck',false

    Data Types: logical

    right —right limit for the censored dependent variable.scalar.

    If set to Inf, the dependent variable is assumed to be not right-censored; default value of left is Inf (classical Tobit model).

    Example: 'right',800

    Data Types: double

    optmin —It contains the options dealing with the maximization algorithm.structure.

    Use optimset to set these options.

    Notice that the maximization algorithm which is used is fminunc if the optimization toolbox is present else is fminsearch.

    Example: 'optmin.Display','off'

    Data Types: double

    Output Arguments

    expand all

    out — description Structure

    Structure which contains the following fields

    Value Description
    Beta

    (p+2)-by-3 matrix containing: 1st col = Estimates of regression coefficients, sigma and lambda;

    2nd col = Standard errors of the estimates 3rd col = t-tests of the estimates

    beta0

    vector containing the estimates of the regression coefficients under z(lambda_0)

    jacla0

    value of the Jacobian which has been used in order to normalize the observations under H_0. The Jacobian just uses uncensored observations.

    LogL

    scalar. Value of the maximized log likelihood using lambda (ignoring constants).

    Exflag

    Reason fminunc stopped in the maximization of the unconstrained likelihood. Integer.

    out.Exflag is equal to 1 if the maximization procedure did not produce warnings or the warning was different from "ILL Conditioned Jacobian". For any other warning which is produced (for example, "Overparameterized", "IterationLimitExceeded", 'MATLAB:rankDeficientMatrix") out.Exflag is equal to -1;

    signLR

    Signed sqrt of the lik ratio test of lambda=la0.

    X

    design matrix which has been used. This output is present just in X is a table containing categorical variables.

    More About

    expand all

    Additional Details

    The issue is one where data is censored such that while we observe the value, it is not the true value, which would extend beyond the range of the observed data. This is very commonly seen in cases where the dependent variable has been given some arbitrary cutoff at the lower or upper end of the range, often resulting in floor or ceiling effects respectively. The conceptual idea is that we are interested in modeling the underlying latent variable that would not have such restriction if it was actually observed.

    In the standard Tobit model (Tobin 1958), we have a dependent variable $y$ that is left-censored at zero: \begin{eqnarray} y_i^* & = & x_i^{\prime} \beta+\varepsilon_i \\ y_i = & 0 & \text { if } y_i^* \leq 0 \\ y_i = & y_i^* & \text { if } y_i^*>0 \end{eqnarray} Here the subscript $i=1, \ldots, n$ indicates the observation, $y_i^*$ is an unobserved ("latent") variable, $x_i$ is a vector of explanatory variables, $\beta$ is a vector of unknown parameters, and $\varepsilon_i$ is a disturbance term.

    The censored regression model is a generalisation of the standard Tobit model.

    The dependent variable can be either left-censored, right-censored, or both left-censored and right-censored, where the lower and/or upper limit of the dependent variable can be any number: \begin{eqnarray} y_i^*=x_i^{\prime} \beta+\varepsilon_i \\ y_i & = & a \qquad \text { if } y_i^* \leq a \\ & = & y_i^* \qquad \text { if } a<y_i^*<b \\ & = & b \qquad \text { if } y_i^* \geq b \end{eqnarray} Here $a$ is the lower limit and $b$ is the upper limit of the dependent variable trasformed. If $a=-\infty$ or $b=\infty$, the dependent variable is not left-censored or right-censored, respectively.

    Censored regression models (including the standard Tobit model) are usually estimated by the Maximum Likelihood (ML) method. Assuming that the disturbance term $\varepsilon$ follows a normal distribution with mean 0 and variance $\sigma^2$, the log-likelihood function is \begin{aligned} \log L=\sum_{i=1}^N & \left[ I_i^a \log \Phi\left(\frac{a-z_i(\lambda)^{\prime} \beta}{\sigma}\right)+I_i^b \log \Phi\left(\frac{x_i^{\prime} \beta-b}{\sigma}\right) \right. \\ & \left.+\left(1-I_i^a-I_i^b\right)\left(\log \phi\left(\frac{y_i-z_i(\lambda)^{\prime} \beta}{\sigma}\right)-\log \sigma\right)\right], \end{aligned} where $\phi( \cdot)$ and $\Phi( \cdot )$ denote the probability density function and the cumulative distribution function, respectively, of the standard normal distribution, and $I_i^a$ and $I_i^b$ are indicator functions with. $z_i(\lambda)$ are the transformed observations using Yeo and Johnson transformation normalized using the Jacabian based on uncensored observations.

    \begin{eqnarray} I_i^a & = & 1 \text { if } y_i=a \\ & = & 0 \text { if } y_i>a \\ I_i^b & = & 1 \text { if } y_i=b \\ & = & 0 \text { if } y_i<b \\ \end{eqnarray} In this file the censored log likelihood above is maximized with respect to the parameter vector $(\beta', \sigma)$ using routine fminunc of the optimization toolbox

    References

    Greene, W.H. (2008), "Econometric Analysis, Sixth Edition", Prentice Hall, pp. 871-875.

    Henningsen, A. (2012), Estimating Censored Regression Models in R using the censReg Package, [https://cran.r-project.org/web/packages/censReg/vignettes/censReg.pdf

    Kleiber C., Zeileis A. (2008), "Applied Econometrics with R", Springer, New York.

    Tobin, J. (1958), Estimation of Relationships for Limited Dependent Variables, "Econometrica", 26, pp. 24-36.

    This page has been automatically generated by our routine publishFS