Singularity error when doing Tobit regression

Refresh

5 weeks ago

Views

92 time

1

I'm trying to estimate a standard tobit model which is censored left at zero.

Variables are

Dependent variable: Happiness

Independent variable:

  • City(Chicago,New York),
  • Gender(Man,Woman),
  • Employment(0=Unemployed, 1=Employed),
  • Worktype(Unemployed, Bluecolor, Whitecolor),
  • Holiday(Unemployed, 1day a week, 2days a week)

'Worktype' and 'Holiday' variables are interacted with 'Employment' variable.

I'm using censReg package for tobit regression.

censReg(Happiness ~ City + Gender + Employment:Worktype + Employment:Holiday)

But summary() returns following error.

Error in printCoefmat(coef(x, logSigma = logSigma), digits = digits) : 
  'x' must be coefficient matrix/data frame

To find out why, I ran OLS regression.

There are some NA values, which I think is because of the model design and variable setting(there seems to be singularities for some variables. And people with 'Employment' = 0 has value 'Worktype' = Unemployed , 'Holidays' = Unemployed. This might be the reason?)

lm(Happiness ~ City + Gender + Employment:Worktype + Employment:Holiday)


Coefficients: (2 not defined because of singularities)
                               Estimate Std. Error t value Pr(>|t|)  
(Intercept)                      41.750      9.697   4.305   0.0499 *
CityNew York                    -44.500     11.197  -3.974   0.0579 .
Gender1                           2.750     14.812   0.186   0.8698  
Employment:WorktypeUnemployed        NA         NA      NA       NA  
Employment:WorktypeBluecolor     35.000     17.704   1.977   0.1867  
Employment:WorktypeWhitecolor   102.750     14.812   6.937   0.0202 *
Employment:Holiday1 day a week  -70.000     22.394  -3.126   0.0889 .
Employment:Holiday2 day a week       NA         NA      NA       NA 

How can I just ignore NA values and run tobit regression without error?

below are reproducible code.

Happiness <- c(0, 80, 39, 0, 69, 90, 100, 30)

 City <- as.factor(c("New York", "Chicago", "Chicago", "New York", "Chicago", 
"Chicago", "New York", "New York"))
 Gender <- as.factor(c(0, 1, 0, 1, 1, 1, 0, 1)) # 0 = man, 1 = woman.
 Employment <- c(0,1, 0, 0, 1 ,1 , 1 , 1) # 0 = unemployed, 1 = employed.
 Worktype <- as.factor(c(0, 2, 0, 0, 1, 1, 2,2))
 levels(Worktype) <- c("Unemployed", "Bluecolor", "Whitecolor")
 Holiday <- as.factor(c(0, 1, 0, 0, 2, 2, 2, 1))
 levels(Holiday) <- c("Unemployed", "1 day a week", "2 day a week")

 data <- data.frame(Happiness, City, Gender, Employment, Worktype, Holiday)
 reg <- lm(Happiness ~ City + Gender + Employment:Worktype +      
           Employment:Holiday)
 summary(reg)

 install.packages("censReg")
 library(censReg)
 tobitreg <- censReg(Happiness ~ City + Gender + Employment:Worktype +      
                     Employment:Holiday)
 summary(tobitreg)

0 answers