Table 5. AR(1) for  (n,T)=(60,36), (84,48)

Introduction

This notebook shows how Table 5 in our article "Power Computations for Intervention Analysis" can be generated using our Mathematica package, IAPower.m.  To produce the tables in TEX or LATEX we use the function WriteTable available in the package WriteTable.m available from MathSource.

First we load the required packages,

<< c:/p/2003/tex/Technometrics/webpage/WriteTable.m

<< c:/p/2003/tex/Technometrics/webpage/IAPower.m

Output in Tex/LaTex format will be sent to files in this directory,

outDirectory = "c:/p/2003/tex/Technometrics/";

?PowerFunctionωARMA

Options[PowerFunctionωARMA]

Table 1.  AR(1) Case.

Power function for an upper-tail test for T = 36,  n=60 (Design 1) and T = 48,  n = 84 (Design II).

ds = Range[0, 2, 0.25]; ps = Range[0, 0.75, 0.25];

Remark: Because PowerFunctionωARMA does symbolic computation, it will attempt to use exact arithmetic which can result in long-winded answers.  If you are just interested in the numerical value it is best to use the numeric function N to make sure the result is converted to floating point.  Here we use the postfix form.

t36 = 
      Table[PowerFunctionωARMA[36, 60, 0.05, 
            ds[[
              i]], {ps[[
                j]]}, {}, Tail -> "UpperTail"], {i, 
            Length[ds]}, {j, Length[ps]}] // N

MySy = 
        StyleForm[#, FontFamily -> Helvetica, 
            FontColor -> RGBColor[0, 0, 1]] &;

TableForm[t36, 
      TableHeadings -> {Table[
            StringForm["δ = ``", 
                NumberForm[ds[[i]], 3]] // 
              MySy, {i, Length[ds]}], 
          Table[StringForm["ϕ = ``", 
                NumberForm[ps[[i]], 3]] // 
              MySy, {i, Length[ps]}]}]

T = 48,  n = 84

t48 = 
      Table[PowerFunctionωARMA[48, 84, 0.05, 
            ds[[
              i]], {ps[[
                j]]}, {}, Tail -> "UpperTail"], {i, 
            Length[ds]}, {j, Length[ps]}] // N

MySy = 
        StyleForm[#, FontFamily -> Helvetica, 
            FontColor -> RGBColor[0, 0, 1]] &;

TableForm[t48, 
      TableHeadings -> {Table[
            StringForm["δ = ``", 
                NumberForm[ds[[i]], 3]] // 
              MySy, {i, Length[ds]}], 
          Table[StringForm["ϕ = ``", 
                NumberForm[ps[[i]], 3]] // 
              MySy, {i, Length[ps]}]}]

Obtain the merged table and output in Tex format

\(\(tablecols = 
        Prepend[{"\phi_1=0", \ "\phi_1=0.25", \ "\phi_1=0.5", "\phi_1=0.75"}, "\delta"];\)\)

rownames = PaddedForm[#, {4, 3}] & /@ 
          Range[0, 2, 0.25];

xy = MergeMatricies[t36, t48];

TableForm[xy, 
      TableHeadings -> {Table[
            StringForm["δ = ``", 
                NumberForm[ds[[i]], 3]] // 
              MySy, {i, Length[ds]}], 
          Table[StringForm["ϕ = ``", 
                NumberForm[ps[[i]], 3]] // 
              MySy, {i, Length[ps]}]}]

WriteTable[outDirectory <> "Table1.tex", xy, 
      NumDecimals -> False, ColumnNames -> tablecols, 
      PrependColumn -> rownames]