简体   繁体   中英

Tobit Regression Chi-Square

First off, I'm replicating a Tobit Regression table that includes Chi-Square and Pr > Chi-Square aside from the coef estimates.

I'm familiar with the general concept for Tobit and Chi-Square testing but I'm not familiar enough with it to be able to reproduce it mathematically. Specifically, I'm trying to figure out how to recover Chi-Square for this in Python.

I'm using this package. It's clear how to recover the coefs and I thought the .sigma_ attribute would be what I'm looking for but it's scalar and not a vector so I'd be surprised if it was related to the standard errors for the coefs.

If I could get some steering in the right direction that'd be awesome.

You might want to try this code, to get the coefficient of determination, which is a good indicator for what you need:

import numpy as np
x = <your set of dependent variables>
y = <your independent variable>
cens = <the cens vector as defined in the library documentation>

tobit  = TobitModel()
rTobit = tobit.fit(x, y, cens, verbose=False)
yHat   = rTobit.predict(x)
yHat   = yHat.reshape(yHat.shape[0],1)

yMean = np.full((yHat.shape[0],1), y.mean()[0])

cDet  = np.dot(np.transpose(yHat-yMean), yHat-yMean) / np.dot(np.transpose(y-yMean), y-yMean)

Tobit regression is very useful in cases when you are estimating variables like percentage of availability, which range between 0 and 100.

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