簡體   English   中英

R 中的 tobit 模型,使用 censReg(),具有刪失觀察的任意觀察值

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

使用 censReg() 函數估計 R 中的 tobit 模型。 似乎審查觀察的觀察值應該無關緊要(當然,只要它們低於審查值)。 在下面的代碼中比較 tobit1 和 tobit2 是正確的。 但是,當我稍微改變觀察值(從 -2.8e5 到 -2.9e5)時,結果完全改變。 知道這里發生了什么嗎?

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

嗯,這很令人失望。 我遇到了通過谷歌確定censReg在包“censReg”中的麻煩(從censReg並不明顯),安裝包及其依賴項,並加載“censReg”和“stargazer”。 現在我明白了:

> # 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

因此,您收到了未提供的警告消息,並且您可能發現了特定於您正在使用的操作系統的錯誤,而您尚未披露。 我在 Ubuntu 18.04 機器上使用 R 3.6.1。 您應該確定您使用的是最新版本的 R(盡管我還沒有更新到 3.6.2)和所有涉及的包(注意我有 stargazer_5.2.2 + censReg_0.5-30 + maxLik_1。 3-6) 如果是這樣,請將錯誤報告發送至:

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

請附上您的:

 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     

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM