Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using bayesmh to simulate a tobit model

    Hi all,

    I am trying to do some bayesion simulations after estimating a tobit model. Using the bayes prefix command will not work as the command "bayespredict" is not available after "bayes: tobit"
    Thus, I am tryng to use bayesmh and estimate a tobit model introducing explicitly the Log-likelihood evaluator
    However I am doing something wrong

    This is my program using simulated data

    clear all
    / * simulated data for tobit estimation */
    set seed 12345
    set obs 1000
    gen x1=invnormal(runiform())
    gen x2=invnormal(runiform())
    scalar a0=.5
    scalar a1=.3
    scalar a2=.1
    gen e=invnormal(runiform())
    gen y=a0+a1*x1+a2*x2+e
    gen y1=y
    replace y1=0 if y<=0
    ******************************
    capture program drop mytobit
    program mytobit
    version 17
    args lnf beta sigma
    quietly replace `lnf'= log(1-normal(`beta'/`sigma')) if $ML_y1==0
    quietly replace `lnf'= log((1/`sigma')*normalden(($ML_y1-`beta')/`sigma')) if $ML_y1>0
    end
    ******************************
    bayesmh y1 x1 x2, llevaluator(mytobit) prior({y1:}, flat)
    bayespredict {_ysim} if y1==0, saving(reps) rseed(123)


    Thanks in adavance

    Javier
Working...
X