Dear Shuai,
I had a quick look, and tried your code with random numbers, which works.
My guess is that the estimation fails for that sample. Either there is a problem
with the database, or d goes towards 0.5 (for example).
Modify your code as follows:
decl forc1;
arfima.SetPrint(FALSE);
for (i = 1; i < 1196; ++i)
{
arfima.SetSelSample(1+i, 1, 1005+i, 1);
MaxControl(-1,0,1);
if (arfima.Estimate())
{
//conditional RV
forc1 = arfima.Forecast(1);
RV[i-1][0] = exp(forc1[0][0] + 0.5*(forc1[0][1])^2);
}
else
{
RV[i-1][0] = .NaN;
println("Estimation for i= ", i, "failed");
}
println("There are ",1195-i," loops left...");
}
Jurgen
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
oxoxoxox US OxMetrics user conference 2010
oxoxoxox George Washington University, Washington DC
oxoxoxox 18-19 March 2010
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
Dr Jurgen A Doornik
University of Oxford, Nuffield College, Oxford OX1 1NF
tel. UK: +44-1865-278610 fax +44-1865-278621
http://www.doornik.com
http://www.oxmetrics.net
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
Shuai Yang wrote:
> Hi all,
>
> I was doing a loop of arfima models, using ARFIMA1.04. But after about 180
> loops ox stops and report a error:
>
> ''Runtime error: out of memory
> Runtime error occurred in Grow(389), call trace:
> D:\OxMetrics5\Ox\src\database.ox (389): Grow
> D:\OxMetrics5\Ox\src\modelbase.ox (82): Grow
> D:\OxMetrics4\Ox\packages\arfima\arfima.ox (1024): Forecast
> D:\Program Files\OxMetrics5\Ox\VaR codes\IN_SAMPLE\RV\ARFIMAX1.ox
> (38): main
>
> Ox reports errors: exit code= 2!!''
>
> Can anyone help me with this issue? Thanks very much. My PC has 3g memory
> and OS is Windows XP sp2. Below is my arfima codes:
>
> #include <oxstd.h>
> #include <oxfloat.h>
> #import <packages/arfima/arfima>
> #include <oxdraw.h>
>
>
> main()
> {
> decl n=1195;
> decl arfima,i,RV=new matrix[n][1];
>
> arfima = new Arfima();
>
> arfima.Load("/data/100times return RV.csv");
>
> arfima.Deterministic(FALSE);// create Constant,Trend,Seasonals
>
> arfima.Select(Y_VAR, { "LRV_future", 0, 0 } );
> arfima.Select(X_VAR, { "Constant", 0, 0 } );
> arfima.Select(X_VAR, { "daily_future", 0, 0 } );
> arfima.Select(X_VAR, { "dummy_future", 0, 0 } ); //data
> already laged
>
>
> arfima.ARMA(0,1); // ARFIMA(0,d,1)
> arfima.SetMethod(M_MAXLIK);
> arfima.UseSampleMean();
>
>
> for (i=1; i<1196;++i)
> {
> arfima.SetSelSample(1+i, 1, 1005+i, 1);
> MaxControl(-1,0,1);
>
> arfima.Estimate();
>
> RV[i-1][0]=exp(arfima.Forecast(1)[0][0]+0.5*(arfima.Forecast(1)[0]
> [1])^2); //conditional RV
> arfima.SetPrint(TRUE);///
> print("There are ",1195-i,"loops left...");
> arfima.SetPrint(FALSE);///
> }
>
> print(RV);
> delete arfima;
> }
>
>
> Best regards,
>
> Shuai
|