Dear Stata experts,
I have the following program to generate conditional skewness and kurtosis, which is running and it produces coefficients but it does not converge.
and I have problems with the intercepts, (mu, b0, c0, g0), Stata produces way too large coefficients, and the other coefficients are close, I think this is because Stata fails to converge.
I think there is something wrong with the linear form (lf), and maybe I need to change that to general form, which I don't know how to do it. if anyone can help me with that.
Or maybe there is something that I'm missing, any thoughts (on why Stata fails to converge) are highly appreciated
Thanks in advance,
Sarah
the following is the program:
//////////////////////////////////////
clear
set more off
set fredkey 0c79529a0ad2485bee772c948e68374e, permanently
import fred DEXJPUS, daterange(1990-01-02 2002-03-01) aggregate(daily,eop) clear
tsset daten
format daten %td
gen ret = 100*(ln(DEXJPUS)-ln(L.DEXJPUS))
drop if _n==1
sum ret, detail
global h0=r(Var)*(r(N)-1)/r(N)
global s0=r(skewness)
global k0=r(kurtosis)
* Own maximum likelihood program GARCHSK*
capture program drop garchsk
program garchsk
//version 17
args lnf mu b0 b1 b2 c0 c1 c2 g0 g1 g2
tempvar et ht nt st kt psi gam
qui gen double `et'=$ML_y1-`mu'
qui gen double `ht'=$h0
qui gen double `nt'=`et'/sqrt(`ht')
qui sum `nt', detail
qui gen double `st'=r(skewness)
qui gen double `kt'=r(kurtosis)
qui replace `ht'=`b0'+`b1'*`et'[_n-1]^2 + `b2'*`ht'[_n-1] if _n>1
qui replace `st'=`c0'+`c1'*`nt'[_n-1]^3 + `c2'*`st'[_n-1] if _n>1
qui replace `kt'=`g0'+`g1'*`nt'[_n-1]^4 + `g2'*`kt'[_n-1] if _n>1
qui gen double `psi'= ln((1 + (`st'*(`nt')^3 - 3*`nt')/(exp(lnfactorial(3))) + (`kt'*(((`nt')^4-6*(`nt')^2+3))/(exp(lnfactorial(4)))))^2)
qui gen double `gam'= ln(1+ (`st'^2)/(exp(lnfactorial(3))) + (`kt'^2)/(exp(lnfactorial(4))))
qui replace `lnf'= -0.5*(ln(`ht')+(`et'^2)/`ht') + `psi'-`gam'
end
ml model lf garchsk (mu: ret=) /b0 /b1 /b2 /c0 /c1 /c2 /g0 /g1 /g2, technique(bhhh)
ml init mu:_cons= -0.003 /b0=0.0061 /b1=0.0309 /b2=0.9537 /c0=-0.0494 /c1=0.0018 /c2=0.3414 /g0=1.2365 /g1=0.0014 /g2=0.6464
ml search
ml max, difficult
ml graph
ml report
/////////////////////////////////////////
0 Response to ML fails to converge
Post a Comment