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
/////////////////////////////////////////
Related Posts with ML fails to converge
causal effect in panel dataHi there, I am struggling to understand something relating to causal effects with panel data. I ha…
ivreghdfeHello all, i try to do an iv regression with fixed effetcs (industry and year) and want to cluster …
Last 4 months always omitted because of collinearity - Panel DataHi everybody, I do run into an issue when i try to hold my monthly dates fix in a panel regression.…
merging multiple excel file from a folder using key variable household id and monthI have many excel files in a folder and each data file contains variable VDS_ID and SUR_MON_YR. I wa…
Do the regression for only one company each and saving them to an excel/doc (ASDOC)Hi everybody, I do have a panel dataset where every company has a unique ID (-company-) and their r…
Subscribe to:
Post Comments (Atom)
0 Response to ML fails to converge
Post a Comment