| Library: | metrics |
| See also: | glmbipro |
| Macro: | tobit | |
| Description: | 2-step estimation of a Tobit model |
| Usage: | {b,s,cv} = tobit(x,y) | |
| Input: | ||
| x | n x d matrix , the observed explanatory variable | |
| y | n x 1 matrix , the observed response variable | |
| Output: | ||
| b | d x 1 vector, contains the estimated coefficients of the components of x | |
| s | scalar, contains the estimated standard deviation of the error term | |
| cv | (d+1)x(d+1) matrix, estimated covariance matrix for [b,s] | |
library("metrics")
n = 500
k = 2
x = matrix(n)~aseq(1, n ,0.25)
s = 8
u = s*normal(n)
b = #(-9, 1)
ystar = x*b+u
y = ystar.*(ystar.>=0)
tstep = tobit(x,y)
tstep.b
tstep.s
tstep.cv
dg = matrix(rows(tstep.cv),1)
dig = diag(dg)
stm = dig.*tstep.cv
std = sqrt(sum(stm,2))
coef = tstep.b|tstep.s
coef~(coef./std) ; t-ratios
2-step estimates of b and s
| Library: | metrics |
| See also: | glmbipro |