Power Simulation

Initializie

<< d:/math/2004/uta.m

omegas = {0.5, 0.75, 1}; deltas = {0.25, 0.5, 0.75};

?SimulateIA

i = 1;
z = 
        SimulateIA[50, 
          25, {omegas[[
              i]]}, {deltas[[
              i]]}, {0.5}, {}];
IAFit[z, 25, 0]

?IAFit

InformationMatrixIA[50, 25, {1}, {}, {0.5}, {}]

SEOmega[n_, T_, 
        phi1_] := Flatten[
            Inverse[InformationMatrixIA[n, T, {1}, {}, {phi1}, {}]]] // 
          Last // Sqrt

SEOmega[50, 25, 0.5]

Initialize Link

link = Install[
        LinkLaunch["d:/MathLink/earmaM/Debug/earmaM.exe"]]

LinkPatterns[link]

SimDynIA[NREP_, phi1_, omegas_, deltas_] := 
        Module[
{}, 
n = 50; T = 25; 
          outSim = {}; 
ITMax = 
            1.25*NREP; 
sehat = 
            SEOmega[n, T, phi1] // 
              N; 
Do[
iSim = 1; 
            k = 0; 
While[
              iSim < ITMax  &&  iSim <  NREP, 
z = 
                SimulateIA[50, 
                  25, {omegas[[
                      iOmega]]}, {deltas[[
                      iDelta]]}, {phi1}, {}]; 
outFitted =  
                EarmaM[{0}, {0}, {T}, {1}, 1, 0, 0, 0, 0, 0, 1, 0, 1, z, 
                  0, {}, 0, {}, 0]; 
phihat = 
                outFitted[[1]]; 
what = 
                outFitted[[2]]; 
Zobs = what/sehat; 
k += 
                If[Abs[Zobs] > 1.96, 1, 
                  0]; 
iSim++;
]; 
p = k/NREP // N; 
sdp = 
              Sqrt[p*(1 - p)/NREP]; 
outSim = {outSim, 
                p}, 
{iOmega, 1, 
              Length[omegas]}, 
{iDelta, 1, 
              Length[deltas]}]; 
outSim = 
            Partition[Flatten[outSim], 
              3]; 
outSim
];

omegas

deltas

Simulations

\(\(outDirectory = "d:/math/2004/PowerIA/Simulation/SimpleDynamicIA";\)\)

phi1 = 0.5

n=100

SeedRandom[5777181];

(out1 = SimDynIA[100, 0.5, omegas, deltas]) // Timing

out1 // TableForm

Export[outDirectory <> "/out1.tsv", out1]

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, 0.5, omegas, deltas]) // Timing

Export[outDirectory <> "/out2.tsv", out2]

out2 // TableForm

phi1 = 0.0

phi1 = 0;

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, phi1, omegas, deltas]) // Timing

Export[outDirectory <> "/outphi0.tsv", out2]

out2 // TableForm

phi1 = -0.5

phi1 = -0.5;

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, phi1, omegas, deltas]) // Timing

Export[outDirectory <> "/outm0p5.tsv", out2]

out2 // TableForm

phi1 = -0.75

phi1 = -0.75;

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, phi1, omegas, deltas]) // Timing

Export[outDirectory <> "/outm0p75.tsv", out2]

out2 // TableForm

phi1 = 0.25

phi1 = 0.25;

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, phi1, omegas, deltas]) // Timing

Export[outDirectory <> "/out0p25.tsv", out2]

out2 // TableForm

phi1 = 0.75

phi1 = 0.75;

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, phi1, omegas, deltas]) // Timing

Export[outDirectory <> "/out0p75.tsv", out2]

out2 // TableForm

phi1 = 0.9

phi1 = 0.9;

n=1000

SeedRandom[5777181];

(out2 = SimDynIA[1000, phi1, omegas, deltas]) // Timing

Export[outDirectory <> "/out0p9.tsv", out2]

out2 // TableForm