From | Ernest Berkhout <[email protected]> |
To | [email protected] |
Subject | RE: st: calling the value of a scalar into a variable |
Date | Mon, 06 Oct 2003 13:32:45 +0200 |
At 12:36 6-10-2003, you wrote:
Stata users,One approach could be to create a dataset within your loop, recording in one variable the number of lags you include (`x' that is) and in the second and third the matching AIC`x' and SIC`i'. As far as I know -but that knowledge might still be superseded by more experienced programmers- that might best be done using 'postfile'.
I have a small problem that I am sure can be solved by you experts. I am running some dickey fuller test, and computing my own Akaike Information criteria or Scharwtz Information Criteria. I saved the results of these in a scalar.
I want to ask stata to create a variable that computes the minimum of the AIC or SIC and return the value in that variable, rather than me cheking it from the screen everytime. Can anybody help please? I am copying the loop file below.
local z "1 2 3 4 5 6"
foreach x of local z{
regress D.netpremmean L.netpremmean L`x'D.netpremmean
matrix b`x'=get(_b)
scalar AIC`x'=log(_result(4)/_result(1))+(colsof(b`x')/_result(1))*2
scalar SIC`x'=log(_result(4)/_result(1))+(colsof(b`x')/_result(1))*log(_result(1))
}
scalar list
So rather than calling scalar list and looking at the screen, I want a variable that stores the min of AIC and SIC so that I can see it in the data editor. I want to do that because at some point I would need to loop that over many series.
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |