<< FitARMA.m

Starting Value at Estimated Parameter Values

StartTime = TimeUsed[];
SeedRandom[331177891];
ns = Table[10^k, {k, 2, 6}];
NREP = 10;
tHR = tHRMleMean = tHRMle = tXMle = tXMleMean = t0Mle = t0MleMean = Array[0 &,  
                      Length[ns]];
Do[
t0 = t1 = t2 = t3 = t4 = t5 = t6 = 
                      0; 
Do[
z = 
            SimulateGaussianARMA[{0.9}, {0.5}, 
              ns[[
                i]]]; 
t0  += 
            First[ Timing[(binit = 
                    InitARMA[1, 1, z])]]; 
t1  +=  
            First[Timing[
                GetARMAMeanFit[1, 1, 30, z, 
                  InitialEstimates -> 
                    binit]]]; 
t2  +=  
            First[Timing[
                GetARMAFit[1, 1, 30, z, 
                  InitialEstimates -> 
                    binit]]]; 
t3  +=  
            First[Timing[
                GetARMAMeanFit[1, 1, 30, z, 
                  InitialEstimates -> {0.9, 
                      0.5}]]]; 
t4 +=  
            First[Timing[
                GetARMAFit[1, 1, 30, z, 
                  InitialEstimates -> {0.9, 
                      0.5}]]]; 
t5  +=  
            First[Timing[
                GetARMAMeanFit[1, 1, 30, z]]]; 
t6 +=  
            First[Timing[
                GetARMAFit[1, 1, 30, 
                  z]]];
, 
{NREP}]; 
tHR[[
            i]] = (t0/NREP) /. Second -> 1 // 
            N; 
tHRMleMean[[
            i]] = (t1/NREP) /. Second -> 1 // 
            N; 
tHRMle[[
            i]] = (t2/NREP) /. Second -> 1 // 
            N; 
tXMleMean[[
            i]] = (t3/NREP) /. Second -> 1 // 
            N; 
tXMle[[
            i]] = (t4/NREP) /. Second -> 1 // 
            N; 
t0MleMean[[
            i]] = (t5/NREP) /. Second -> 1 // 
            N; 
t0Mle[[
            i]] = (t5/NREP) /. Second -> 1 // 
            N;
, 
{i, 
          Length[ns]}];
EndTime = TimeUsed[];
ElapsedTime  =  StartTime - EndTime;
Print["Time Used = ", ElapsedTime];
\(TableForm[
      tb = Transpose[{t0Mle, tHR, tXMle, tHRMle, t0MleMean, tXMleMean, 
            tHRMleMean}], 
      TableHeadings -> {ns, {"MLE0", "HR", \ "MLEX", "MLEHR", "MLE0-Mean", "MLEX-Mean", "MLEHR-Mean"}}]\)