简体   繁体   中英

tobit model in R, using censReg(), with arbitrary observed values of censored observations

Estimating a tobit model in R using the censReg() function. It seems like the observed values for the censored observations should not matter (so long as they are below the censoring value, of course). This is true comparing tobit1 to tobit2 in the code below. But then, when I change the observed values by just a bit (from -2.8e5 to -2.9e5) the results change entirely. Any idea what's going on here?

set.seed(8)
n = 200
x = rnorm(n)
a=3; b = 3
# generate latent y; censoring value k; and observed z
y = rnorm(n, a+b*x)
k = 2
z = ifelse(y>k, y, 0)
table(z==0) # 82 T, 118 F

# tobit with "reasonable" observed values for censored obs:
tobit1 = censReg(z~x,left=k) 

# tobit with arbitrarily low observed values for censored obs:
z2 = ifelse(y>k, y, -2.8e5)
tobit2 = censReg(z2~x,left=k) 
# ... and even lower:
z3 = ifelse(y>k, y, -2.9e5)
tobit3 = censReg(z3~x,left=k) 

stargazer(tobit1,tobit2,tobit3,type='text')

=================================================
                         Dependent variable:     
                    -----------------------------
                        z        z2        z3    
                       (1)      (2)       (3)    
-------------------------------------------------
x                   2.988***  2.988*** 8,518.070 
                     (0.109)  (0.109)            

logSigma             -0.090    -0.090    8.808   
                     (0.065)  (0.065)            

Constant            2.937***  2.937*** -7,792.855
                     (0.097)  (0.097)            

-------------------------------------------------
Observations           200      200       200    
Log Likelihood      -177.353  -177.353 -1,201.950
Akaike Inf. Crit.    360.707  360.707  2,409.899 
Bayesian Inf. Crit.  370.602  370.602  2,419.794 
=================================================
Note:                 *p<0.1; **p<0.05; ***p<0.01

Well, that was disappointing. I went through the trouble of determining via Google that censReg was in the package 'censReg' (a fact that is not obvious on the face of it), installing the package and its dependencies, and loading both 'censReg' and 'stargazer'. Now I get this:

> # tobit with "reasonable" observed values for censored obs:
> tobit1 = censReg(z~x,left=k) 
Warning message:
In censReg(z ~ x, left = k) :
  at least one value of the endogenous variable is smaller than the left limit
> 
> # tobit with arbitrarily low observed values for censored obs:
> z2 = ifelse(y>k, y, -2.8e5)
> tobit2 = censReg(z2~x,left=k) 
Warning message:
In censReg(z2 ~ x, left = k) :
  at least one value of the endogenous variable is smaller than the left limit
> # ... and even lower:
> z3 = ifelse(y>k, y, -2.9e5)
> tobit3 = censReg(z3~x,left=k) 
Warning message:
In censReg(z3 ~ x, left = k) :
  at least one value of the endogenous variable is smaller than the left limit

stargazer(tobit1,tobit2,tobit3,type='text')

=================================================
                         Dependent variable:     
                    -----------------------------
                        z        z2        z3    
                       (1)       (2)       (3)   
-------------------------------------------------
x                   2.988***  2.988***  2.988*** 
                     (0.109)   (0.109)   (0.109) 

logSigma             -0.090    -0.090    -0.090  
                     (0.065)   (0.065)   (0.065) 

Constant            2.937***  2.937***  2.937*** 
                     (0.097)   (0.097)   (0.097) 

-------------------------------------------------
Observations           200       200       200   
Log Likelihood      -177.353  -177.353  -177.353 
Akaike Inf. Crit.    360.707   360.707   360.707 
Bayesian Inf. Crit.  370.602   370.602   370.602 
=================================================
Note:                 *p<0.1; **p<0.05; ***p<0.01

So you are getting warning messages that you had not offered and you may have found an infelicity that is specific only to the OS you are using, which you have not disclosed. I'm using R 3.6.1 on an Ubuntu 18.04 box. You should determine that you are using an up-to-date version of R (despite my not yet having updated to 3.6.2) and all the packages involved (noting that I have stargazer_5.2.2 + censReg_0.5-30 + maxLik_1.3-6) and if so, send a bug report to:

 maintainer("censReg")
[1] "Arne Henningsen <arne.henningsen@gmail.com>"

Do attach your:

 sessionInfo()

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] stargazer_5.2.2   censReg_0.5-30    maxLik_1.3-6      miscTools_0.6-22  vars_1.5-3       
 [6] lmtest_0.9-37     urca_1.3-0        strucchange_1.5-1 sandwich_2.5-1    zoo_1.8-6        
[11] MASS_7.3-51.4     MTS_1.0          

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3          Formula_1.2-3       magrittr_1.5        lattice_0.20-38    
 [5] bibtex_0.4.2        stringr_1.4.0       timeSeries_3042.102 tools_3.6.1        
 [9] grid_3.6.1          glmmML_1.1.0        timeDate_3043.102   nlme_3.1-141       
[13] yaml_2.2.0          bdsmatrix_1.3-3     Rdpack_0.11-0       gbRd_0.4-11        
[17] plm_2.1-0           fGarch_3042.83.1    stringi_1.4.3       compiler_3.6.1     
[21] fBasics_3042.89     spatial_7.3-11      mvtnorm_1.0-11     

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM