Hi,
I am trying to estimate a censored regression (Tobit type I model) and control for underreporting on the dependent variable (amount of remittances). The reference is Shonkwiler et al. 2011 (http://www.tandfonline.com/doi/abs/1...9#.Vn7GAvkrLIU).
I am using moptimize() with lf0 evaluator.
Below there is my code:
mata
function llfremit(transmorphic M, real vector b, real vector llf)
{
real colvector xb, mu, llf1,llf2
real colvector y1, delta, sigma
real colvector arg0, arg1, arg2, arg3
y1 = moptimize_util_depvar(M, 1)
xb = moptimize_util_xb(M, b, 1)
sigma=moptimize_util_xb(M,b,2)
mu=moptimize_util_xb(M,b,3)
delta = moptimize_util_userinfo(M,1)
arg0=exp(-mu)
arg1=-sigma:*arg0+(xb-y1):/sigma
arg2=((sigma:*arg0):^2):/2
arg3=(arg2-xb:*arg0)
llf1=ln(normal(arg1))-mu+(y1-xb):*arg0+arg2
llf2=ln(normal(-xb:/sigma)+exp(arg2-xb:*arg0):*normal(xb:/sigma-sigma:*arg0))
llf=delta:*llf1+(1:-delta):*llf2
}
M = moptimize_init()
moptimize_init_evaluator(M, &llfremit())
moptimize_init_depvar(M, 1, y)
moptimize_init_eq_indepvars(M, 1,X[.,1::9])
moptimize_init_eq_indepvars(M, 2, "")
moptimize_init_eq_indepvars(M,3,X[.,10::12])
moptimize_init_userinfo(M,1,d)
moptimize_init_search_random(M,"on")
moptimize(M)
moptimize_result_display(M)
end
The dependent variable (y) is continuous (amount of remittances), d is binary equal to 1 if the remittances are positive and 0 otherwise while X identifies the first nine covariates for the censored model and the last three for the adjustment due to the underreported remittances.
The estimator is not able to achieve the convergence due to discontinuity. The weird thing is that, when the evaluator stops, the value of the llf is almost identical to the llf of the Tobit regression. Theoretically, this could be a good sign since the estimator collapses in the traditional Tobit type I model if there is not underreporting. However, I do not think this is the case in my model. I can provide the dataset.
Many thanks.
Simone Angioloni
I am trying to estimate a censored regression (Tobit type I model) and control for underreporting on the dependent variable (amount of remittances). The reference is Shonkwiler et al. 2011 (http://www.tandfonline.com/doi/abs/1...9#.Vn7GAvkrLIU).
I am using moptimize() with lf0 evaluator.
Below there is my code:
mata
function llfremit(transmorphic M, real vector b, real vector llf)
{
real colvector xb, mu, llf1,llf2
real colvector y1, delta, sigma
real colvector arg0, arg1, arg2, arg3
y1 = moptimize_util_depvar(M, 1)
xb = moptimize_util_xb(M, b, 1)
sigma=moptimize_util_xb(M,b,2)
mu=moptimize_util_xb(M,b,3)
delta = moptimize_util_userinfo(M,1)
arg0=exp(-mu)
arg1=-sigma:*arg0+(xb-y1):/sigma
arg2=((sigma:*arg0):^2):/2
arg3=(arg2-xb:*arg0)
llf1=ln(normal(arg1))-mu+(y1-xb):*arg0+arg2
llf2=ln(normal(-xb:/sigma)+exp(arg2-xb:*arg0):*normal(xb:/sigma-sigma:*arg0))
llf=delta:*llf1+(1:-delta):*llf2
}
M = moptimize_init()
moptimize_init_evaluator(M, &llfremit())
moptimize_init_depvar(M, 1, y)
moptimize_init_eq_indepvars(M, 1,X[.,1::9])
moptimize_init_eq_indepvars(M, 2, "")
moptimize_init_eq_indepvars(M,3,X[.,10::12])
moptimize_init_userinfo(M,1,d)
moptimize_init_search_random(M,"on")
moptimize(M)
moptimize_result_display(M)
end
The dependent variable (y) is continuous (amount of remittances), d is binary equal to 1 if the remittances are positive and 0 otherwise while X identifies the first nine covariates for the censored model and the last three for the adjustment due to the underreported remittances.
The estimator is not able to achieve the convergence due to discontinuity. The weird thing is that, when the evaluator stops, the value of the llf is almost identical to the llf of the Tobit regression. Theoretically, this could be a good sign since the estimator collapses in the traditional Tobit type I model if there is not underreporting. However, I do not think this is the case in my model. I can provide the dataset.
Many thanks.
Simone Angioloni