Derivations AR(1) Case

Before evaluating this notebook, evaluate code.nb

Purpose

To derive using the Pierce approximation the information matrix for the IA component for step, pulse and ramp interventions.  To provide a specialized Mathematica program for this.

Introduction

The general form of the simple step intervention model with ARIMA disturbances may be written,

\(TraditionalForm\`∇\^d z\_t = α + ω\_0\ ∇\^d ℑ\_t\%\((T)\)\  + \ \(\(θ(B)\)\/\(ϕ(B)\)\) 
          a\_t\)

where (Subscript[ℑ, t]^((T))) represents a step, pulse or ramp intervention denoted respectively by,

(Subscript[S, t]^((T)))={({{0, t < T}, {1, t ≥ T}})

(Subscript[P, t]^((T)))={({{0, t ≠  T}, {1, t = T}})

(Subscript[R, t]^((T)))={({{0, t < T}, {t - T + 1, t ≥ T}})

Then the Fisher information matrix for (α,  (Subscript[ω, 0])) is given by

(({{n (κ^2) , \(\(Σ\_t\) κ\ b\_t\)}, {(Subscript[Σ, t]) κ (Subscript[b, t]), \(\(Σ\_t\)\(\ \)\(b\_t\%2\)\(\ \)\)}}))

where κ = -ϕ(1)/θ(1) and (Subscript[b, t]) = -ϕ(B)/θ(
              B)  (Subscript[x, t]), where \(TraditionalForm\`x\_t = \(\(∇\^d ℑ\_t\%\((T)\)\)\(.\)\)\)

Step Intervention

κ = ϕ - 1, (Subscript[b, t]) = -ϕ(B) (Subscript[S, t]^((T)))

(Subscript[b, t])={({{0, if t<T }, {-1, if t = T}, {ϕ - 1, if t > T}})

So (∑_t) (Subscript[b, t]) = (n - T) (ϕ - 1) - 
          1 and (∑_t) (Subscript[b, t]^2) = (n - 
                T) (((1 - ϕ))^2) - 1.  Hence the information matrix is given by

(({{n (((ϕ - 1))^2), (n - T) (((1 - ϕ))^2) + 
                1 - ϕ}, {(n - T) (((1 - ϕ))^2) + 
                1 - ϕ, (n - T) (((1 - ϕ))^2) + 1}}))

InformationMatrixAR1Step[n_, 
        T_,  ϕ_] := 
With[{κ = ϕ - 1, 
          b12 = (n - T) (((1 - ϕ))^2) + 
              1 - ϕ}, {{n (κ^2), 
            b12}, {b12, (n - T) (((1 - ϕ))^2) + 1}}]

Ramp Intervention

κ = ϕ - 1, (Subscript[b, t]) = -ϕ(B) (Subscript[R, t]^((T)))

Ramp[n_?IntegerQ, T_?IntegerQ] := 
      Join[Array[0 &, T - 1], Range[n - T + 1]]

Ramp[20, 10]

Step 1.  -(∑_t) (Subscript[b, t])

b = 
      ICalc[20, 10, {-1, ϕ}, {}, IAType -> "Ramp"]

Plus @@ b

Sum[i, {i, n - T + 1}] // FullSimplify

% /. {n -> 20, T -> 10}

Sum[i - 1, {i, n - T + 1}] // FullSimplify

% /. {n -> 20, T -> 10}

So  -(∑_t) (Subscript[b, t]) = -(1/2) (n + 1 - 
              T) (n + 2 - T  - ϕ (n - T))

sumb[n_, 
        T_, ϕ_] := (1 - ϕ) (n + 1 - 
            T) (n + 2 - T - ϕ (n - T))/2

sumb[20, 10, ϕ] // FullSimplify

sumb[50, 25, ϕ] // FullSimplify

(ϕ - 1)*
        Plus @@ ICalc[20, 10, {-1, ϕ}, {}, 
            IAType -> "Ramp"] /. ϕ -> 0.5

sumb[20, 10, 0.5]

InformationMatrixIAExact[20, 10, {0.5}, {}, 
      IAType -> "Ramp"]

InformationMatrixIAPierce[20, 10, {0.5}, {}, 
      IAType -> "Ramp"]

Step 2.  (∑_t) (Subscript[b, t]^2)

bsq = 
      ICalc[20, 10, {-1, ϕ}, {}, IAType -> "Ramp"]^2 // 
        FullSimplify

Plus @@ bsq // FullSimplify

(1 + (((-2 + ϕ))^2) + 
          Sum[(((i - ϕ (i - 1)))^2), {i, 3, n - T + 1}]) // 
      FullSimplify

% /. {n -> 20, T -> 10} // FullSimplify

%% // Factor

sumbsq[n_, T_, ϕ_] := 
      (1/6) (1 + n - T) (6 + 7 n + 2 (n^2) - 7 T - 4 n T + 
            2 (T^2) - 8 n ϕ - 4 (n^2) ϕ + 8 T ϕ + 
            8 n T ϕ - 4 (T^2) ϕ + n (ϕ^2) + 
            2 (n^2) (ϕ^2) - T (ϕ^2) - 4 n T (ϕ^2) + 
            2 (T^2) (ϕ^2))

sumbsq[20, 10, ϕ] // FullSimplify

InformationMatrixAR1Ramp[n_, 
        T_,  ϕ_] := 
With[{κ = ϕ - 
              1, 
b12 = (1 - ϕ) (n + 1 - 
                  T) (n + 2 - T - ϕ (n - T))/
                2, 
b22 = 
            (1/6) (1 + n - T) (6 + 7 n + 2 (n^2) - 7 T - 4 n T + 
                  2 (T^2) - 8 n ϕ - 4 (n^2) ϕ + 8 T ϕ + 
                  8 n T ϕ - 4 (T^2) ϕ + n (ϕ^2) + 
                  2 (n^2) (ϕ^2) - T (ϕ^2) - 4 n T (ϕ^2) + 
                  2 (T^2) (ϕ^2))}, {{n (κ^2), b12}, {b12, 
            b22}}
]

i = InformationMatrixAR1Ramp[12, 0, 0.5]

Options[SEωAR1] = {MeanZero -> False,  
          IAType -> "Step"};

\(SEωAR1[n_, T_, ϕ_, \ 
        opts___?OptionQ] := 
Module[{}, 
mnQ = \(MeanZero /. {opts}\) /. 
            Options[SEωAR1]; 
iaty = \(IAType /. {opts}\) /. Options[SEωAR1]; 
i = 
          Which[SameQ[iaty, "Step"], 
            InformationMatrixAR1Step[n, T, \ ϕ], 
            SameQ[iaty, "Ramp"], 
            InformationMatrixAR1Ramp[n, T, \ ϕ]]; 
i = 
          If[mnQ, {{i[[2, 2]]}}, 
            i]; 
\(Flatten[Inverse[i]] // Last\) // 
          Sqrt]\)

Pulse Intervention

Then the Fisher information matrix for (α,  (Subscript[ω, 0])) is given by

(({{n (κ^2) , \(\(Σ\_t\) κ\ b\_t\)}, {(Subscript[Σ, t]) κ (Subscript[b, t]), \(\(Σ\_t\)\(\ \)\(b\_t\%2\)\(\ \)\)}}))

where κ = -ϕ(1)/θ(1) and (Subscript[b, t]) = -ϕ(B)/θ(
              B)  (Subscript[x, t]), where \(TraditionalForm\`x\_t = \(\(∇\^d ℑ\_t\%\((T)\)\)\(.\)\)\)

κ = ϕ - 1, (Subscript[b, t]) = -ϕ(B) (Subscript[P, t]^((T)))

(Subscript[b, t])={({{0, if t<T }, {-1, if t = T}, {ϕ - 1, if t > T}})

So (∑_t) (Subscript[b, t]) = (n - T) (ϕ - 1) - 
          1 and (∑_t) (Subscript[b, t]^2) = (n - 
                T) (((1 - ϕ))^2) - 1.  Hence the information matrix is given by

(({{n (((ϕ - 1))^2), (n - T) (((1 - ϕ))^2) + 
                1 - ϕ}, {(n - T) (((1 - ϕ))^2) + 
                1 - ϕ, (n - T) (((1 - ϕ))^2) + 1}}))

Step 1.  -(∑_t) (Subscript[b, t])

b = 
      ICalc[20, 10, {-1, ϕ}, {}, IAType -> "Pulse"]

sumbPulse[n_, T_, ϕ_] := (((1 - ϕ))^2)

Step 2.  (∑_t) (Subscript[b, t]^2)

bsq = 
      ICalc[20, 10, {-1, ϕ}, {}, IAType -> "Pulse"]^2 // 
        FullSimplify

sumbsqPulse[n_, T_, ϕ_] := 1 + (ϕ^2)

InformationMatrixAR1Pulse[n_, 
        T_,  ϕ_] := 
With[{κ = ϕ - 
              1, 
b12 = (((1 - ϕ))^2), 
b22 = (((1 - ϕ))^2)}, {{n (κ^2), b12}, {b12, 
            b22}}
]

i = InformationMatrixAR1Pulse[20, 10, 0.5]

InformationMatrixIAExact[20, 10, {0.5}, {}, 
      IAType -> "Pulse"]

InformationMatrixIAPierce[20, 10, {0.5}, {}, 
      IAType -> "Pulse"]

Options[SEωAR1] = {MeanZero -> False,  
          IAType -> "Step"};

\(SEωAR1[n_, T_, ϕ_, \ 
        opts___?OptionQ] := 
Module[{}, 
mnQ = \(MeanZero /. {opts}\) /. 
            Options[SEωAR1]; 
iaty = \(IAType /. {opts}\) /. Options[SEωAR1]; 
i = 
          Which[
SameQ[iaty, "Step"], 
            InformationMatrixAR1Step[n, 
              T, \ ϕ], 
SameQ[iaty, "Ramp"], 
            InformationMatrixAR1Ramp[n, 
              T, \ ϕ], 
SameQ[iaty, "Pulse"], 
            InformationMatrixAR1Pulse[n, 
              T, \ ϕ]
]; 
i = 
          If[mnQ, {{i[[2, 2]]}}, 
            i]; 
\(Flatten[Inverse[i]] // Last\) // 
          Sqrt
]\)

Backup

DeleteFile["d:/math/2003/PowerIA/work/DerivationsAR1Case.m"];

AllFNS={SEωAR};

Save["d:/math/2003/PowerIA/work/DerivationsAR1Case.m", 
        ALLFNS];

InformationMatrixAR1Ramp[n_, 
        T_,  ϕ_] := 
With[{κ = ϕ - 
              1, 
b12 = (1 - ϕ) (n + 1 - 
                  T) (n + 2 - T - ϕ (n - T))/
                2, 
b22 = 
            (1/6) (1 + n - T) (6 + 7 n + 2 (n^2) - 7 T - 4 n T + 
                  2 (T^2) - 8 n ϕ - 4 (n^2) ϕ + 8 T ϕ + 
                  8 n T ϕ - 4 (T^2) ϕ + n (ϕ^2) + 
                  2 (n^2) (ϕ^2) - T (ϕ^2) - 4 n T (ϕ^2) + 
                  2 (T^2) (ϕ^2))}, {{n (κ^2), b12}, {b12, 
            b22}}
]

tough TeX

\(TeXForm[
        1\/6\ \((1 + n - T)\)\ \((6 + 7\ n + 2\ n\^2 - 7\ T - 4\ n\ T + 
              2\ T\^2 - 8\ n\ ϕ - 4\ n\^2\ ϕ + 8\ T\ ϕ + 
              8\ n\ T\ ϕ - 4\ T\^2\ ϕ + n\ ϕ\^2 + 
              2\ n\^2\ ϕ\^2 - T\ ϕ\^2 - 4\ n\ T\ ϕ\^2 + 
              2\ T\^2\ ϕ\^2)\)] >> "d:/math/2003/PowerIA/work/b22.tex"\)

TeXForm[(1 - ϕ) (n + 1 - 
              T) (n + 2 - T - ϕ (n - T))/
            2] >> "d:/math/2003/PowerIA/work/b12.tex"

Testing

STEP INTERVENTIONS

Simple step intervention with n = 50,  T = 25

SEωAR1[50, 25, 0.5]

SEOmega[50, 25, {0.5}, {}]

SEOmega[50, 25, {0.5}, {}, 
      PierceApproximation -> False]

SEωAR1[50, 25, 0.5, MeanZero -> True]

SEOmega[50, 25, {0.5}, {}, MeanZero -> True]

SEOmega[50, 25, {0.5}, {}, PierceApproximation -> False, 
      MeanZero -> True]

Simple step intervention with n = 12,  T = 1.  The exact information is singular!

SEωAR1[12, 1, 0.5]

SEOmega[12, 1, {0.5}, {}]

SEOmega[12, 1, {0.5}, {}, 
      PierceApproximation -> False ]

Simple step intervention with n = 12,  T = 2.  Pierce approximation not so good!

SEωAR1[12, 2, 0.5]

SEOmega[12, 2, {0.5}, {}]

SEOmega[12, 2, {0.5}, {}, 
      PierceApproximation -> False ]

Simple step intervention with n = 12,  T = 6.  Pierce approximation not so good!

SEωAR1[12, 6, 0.5]

SEOmega[12, 6, {0.5}, {}]

SEOmega[12, 6, {0.5}, {}, 
      PierceApproximation -> False ]

Simple step intervention with n = 24,  T = 12.  Pierce approximation not so good!

SEωAR1[24, 12, 0.5]

SEOmega[24, 12, {0.5}, {}]

SEOmega[24, 12, {0.5}, {}, 
      PierceApproximation -> False ]

RAMP INTERVENTIONS

Simple ramp intervention for n = 20,  T = 10

SEOmega[20, 10, {0.5}, {}, IAType -> "Ramp"]

SEOmega[20, 10, {0.5}, {}, IAType -> "Ramp", 
      PierceApproximation -> False ]

SEOmega[20, 10, {0.5}, {}, IAType -> "Ramp", 
      MeanZero -> True]

SEOmega[20, 10, {0.5}, {}, IAType -> "Ramp", MeanZero -> True, 
      PierceApproximation -> False]

SEωAR1[20, 10, 0.5, IAType -> "Ramp"]

SEωAR1[20, 10, 0.5, IAType -> "Ramp", 
      MeanZero -> True]

Simple ramp intervention for n = 12,  T = 1

SEOmega[12, 1, {0.5}, {}, IAType -> "Ramp"]

SEOmega[12, 1, {0.5}, {}, IAType -> "Ramp", 
      MeanZero -> True]

SEωAR1[12, 1, 0.5, IAType -> "Ramp"]

SEωAR1[12, 1, 0.5, IAType -> "Ramp", 
      MeanZero -> True]