Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65124

Choosing the minimum from several scalars (Information criteria for model with forvalues)

$
0
0
Hello.
How can I choose the min value between several scalars?
I'm trying to select the best model based on the information criteria. For this, I do a forvalue and I'm asking STATA to store the values of the BIC for each model. Then I want that STATA show me which one has the lowest BIC. I have found some examples trying to do similar things using MATA code. I'm not familiar with MATA. I tryed to replicate the example, but didn't work for me.
So far, this is what I got and I don't know how to continue.


forvalues i = 1/5 {
forvalues j =1/5 {
qui reg PIB_var L(1/`i').PIB_var L(1/`j').HH_total_var
qui estat ic
mat stats = r(S)
scalar BIC`i'_`j' = el(stats, 1, 6)
qui actest, lags(`i') small robus
scalar AC`i'_`j' = r(p)
}
}
scalar list

I want STATA to show me the minimum BIC and tell me to which model does it belong. Same for the autocorrelation test.
Can anyone help me please?

Thanks!!

Viewing all articles
Browse latest Browse all 65124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>