I'm trying to calculate the success rate in lag identification for an ARMA model using AC and PAC.
This is my model: Array
First of all, I have a loop (forvalues) that generates 300 observations with my model specified above. Then the idea is to run the ac and pac command to see how many lags that algorithm suggests for my 300 self-made observations.
After this, I want to test if the ac and pac algorithm got the number of lags (for MA and AR) right. If it gets the correct number of lags, I would like to have a variable that stores that correct trial (+1, 0 otherwise).
My idea is to repeat this process a 1000 times and then calculate the overall success rate (that would be a second forvalues).
I'm aware that running the ac and pac function makes a graph to pop up. The visual interpretation is easy, but my problem is how to interpretate the results table to figure out if it got the correct number of lags. The code itself should be able to figure out if the ac/pac suggestion its right.
This is what I've got for now:
Code:
clear all matrix serie = J(300,3,0) matrix simulaciones = J(1000,7,0) set obs 300 gen t = _n tsset t g y1=0 forvalue j = 1(1)1000{ forvalues i = 1(1)300 { gen e = rnormal(0,1) replace y1=0 if t <=2 replace y1 = 0.7*L1.y1 - 0.1*L2.y1 + e - 0.6*L1.e + 0.08*L2.e if t > 2 mkmat t y1 e, matrix(serie) drop e } corrgram y1 ac y1, generate(AC) pac y1, generate(PAC) }
I'm very thankful for your time. This community has been very helpful.
0 Response to AC and PAC simulations to test succes rate
Post a Comment