Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: st.e. with matas maximize


From   Miriam Wüst <miw@sfi.dk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: st.e. with matas maximize
Date   Thu, 16 Apr 2009 12:58:29 +0200

Hello there,
I try again with my question ☺
I am using the optimize command in mata to minimize a criterion function similar to the code shown below. 
After estimating the parameters in the minimization I am in doubt how to use the "optimize_result_V" to obtain  st.e. 
– as I do not maximize a likelihood but minimize the distance of sample moments to theoretical moments.
Anybody who can offer guidance on this topic, i.e. how to obtain st.e.?

Best
Miriam

b=(0,0,0,0) //starting values for parameter estimates
data=(y,X)

variance=variance(data)
c=(variance[1,1], variance[2,1], variance[3,1], variance[4,1])' //sample covariances

W= I(4,4) //weighting matrix

f1=(0,1,1,0\
             0,1,0,0\
             0,0,0,1\
             0,0,0,1
)

f2=(2,0,0,0\
           2,0,0,0\
           0,0,0,0\
           0,0,0,0
)

f2a=(0,0,0,1\
           0,0,0,1\
           0,0,0,0\
           0,0,0,0
)

void evaluator_gmm(todo, p, crit, g, H)
{
         external W
         external c
         external f1
         external f2
         external f2a

crit=(c-f1*p'-(f2*p'):*(f2a*p'))’*W*(c-f1*p'-(f2*p'):*(f2a*p'))
}                     

S=optimize_init()
optimize_init_evaluator(S,&evaluator_gmm())
optimize_init_which(S,"min")
optimize_init_evaluatortype(S,"v0")                
optimize_init_params(S, b)
//optimize_init_technique(bhhh)

ehat=optimize(S)

)

End

optimize_result_V(S)



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index