*********************  Feb 16, 2004
***   ANOVA on the BIC for the AI log-likelihoods

 cd('C:/work/anchor/finalsim') ; load hier_opt_params
 whos
  Name                Size         Bytes  Class

  resAI24_P           1x1          10786  struct array
  resAI24_PS          1x1          11280  struct array
  resAI24_PSA         1x1          11778  struct array
  resAI24_PSAC        1x1          14088  struct array
  resAI24_PSACR       1x1          13000  struct array
  resAI24_PSC         1x1          11806  struct array
  resAI24_PSCR        1x1          13152  struct array
  resCR40_P           1x1          12228  struct array
  resCR40_PS          1x1          12850  struct array
  resCR40_PSA         1x1          13476  struct array
  resCR40_PSAC        1x1          17578  struct array
  resCR40_PSACR       1x1          14664  struct array
  resCR40_PSC         1x1          14908  struct array
  resCR40_PSCR        1x1          14944  struct array

Grand total is 12024 elements using 186538 bytes

 resAI24_P
resAI24_P = 
       model_name: 'modelP_mt'
       descriptor: '28-Dec-2003 16:02:06'
    search_params: [1x1 struct]
            opt_X: [24x1 double]
                L: [24x1 double]
         exitflag: [24x1 double]
          N_evals: [24x1 double]
          N_iters: [24x1 double]
             time: [24x1 double]

 L=[resAI24_P.L,resAI24_PS.L,resAI24_PSC.L,resAI24_PSA.L,resAI24_PSAC.L,resAI24_PSCR.L,resAI24_PSACR.L];
 describe(L)
    Mean  Std.dev       Min     Q25  Median     Q75     Max
------------------------------------------------------------
 500.912   73.550    351.10  462.30  509.35  559.44  616.69
 489.541   71.695    344.78  444.15  495.74  550.17  592.02
 481.613   68.470    343.32  438.18  489.11  529.63  577.54
 513.249   64.605    379.56  472.78  522.58  566.71  602.97
 481.106   67.086    340.66  438.88  493.94  532.26  574.16
 495.028   65.298    364.48  456.88  505.24  547.81  586.96
 491.977   65.742    355.49  453.90  499.49  545.52  580.62
------------------------------------------------------------
 493.346   68.064    354.20  452.44  502.21  547.36  590.14

 parAI=[1 2 3 3 4 3 4]; penalty=log(450)/2
penalty = 3.0546

 BIC=L+repmat(parAI,24,1).*penalty;describe(BIC)
    Mean  Std.dev       Min     Q25  Median     Q75     Max
------------------------------------------------------------
 503.966   73.550    354.16  465.36  512.40  562.49  619.74  % P
 495.650   71.695    350.89  450.26  501.85  556.28  598.13  % PS
 490.777   68.470    352.48  447.34  498.28  538.80  586.71  % PSC
 522.413   64.605    388.72  481.94  531.74  575.87  612.13  % PSA
 493.325   67.086    352.88  451.10  506.16  544.48  586.38  % PSAC
 504.192   65.298    373.64  466.04  514.40  556.97  596.12  % PSCR
 504.195   65.742    367.71  466.12  511.70  557.73  592.84  % PSACR=ANCHOR
------------------------------------------------------------
 502.074   68.064    362.93  461.17  510.93  556.09  598.86


%%% Repeated-measures analysis of variance
%   The model-by-subject interaction serves as the error term
%
 model=repmat([1:7],24,1); IVs=[model(:),repmat([1:24]',7,1)];
 [SS,df,MS,lbl] = anova(BIC(:),IVs,'MS');

Partitioning the sum of squares...
Source         SumSq   eta2[%]     df        MeanSq
---------------------------------------------------
   M       16119.857     2.11       6     2686.6428
   S      741016.862    97.05      23    32218.1244
  MS        6436.087     0.84     138       46.6383
 err           0.000     0.00       0        0.0000
Totl      763572.806   100.00     167     4572.2923
---------------------------------------------------

 F=MS(1)/MS(3) , p=1-fcdf(F,df(1),df(3))
F = 57.6059
p = 0

 s_err = sqrt(MS(3)/24)
s_err = 1.3940

 CI95=s_err * tinv(.975,df(3))
CI95 = 2.7564



*********************************************************************
**
**  ANALOGOUS ANALYSIS OF THE 40 CATEGORY RATING PARAMETER SETS
**

 Lcr=[resCR40_P.L,resCR40_PS.L,resCR40_PSC.L,resCR40_PSA.L,resCR40_PSAC.L,resCR40_PSCR.L,resCR40_PSACR.L];
 describe(Lcr)
    Mean  Std.dev       Min     Q25  Median     Q75     Max
------------------------------------------------------------
 608.971   79.000    449.67  548.81  605.97  669.24  756.12
 586.091   76.658    445.77  528.63  585.06  631.86  746.99
 601.573   86.946    445.16  523.89  599.91  670.36  761.60
 536.709   62.044    440.45  490.53  516.61  582.66  667.10
 522.186   69.338    415.36  467.20  508.18  568.98  691.37
 543.025   86.564    396.63  479.10  514.90  601.85  738.48
 460.059   82.941    316.99  404.75  446.01  510.16  666.10
------------------------------------------------------------
 551.231   77.642    415.72  491.84  539.52  605.02  718.25

 parCR=[2 3 4 4 5 3 4]; penalty=log(450)/2
 BICcr=Lcr+repmat(parCR,40,1).*penalty;describe(BICcr)
    Mean  Std.dev       Min     Q25  Median     Q75     Max
------------------------------------------------------------
 615.080   79.000    455.78  554.92  612.08  675.35  762.23  % P
 595.255   76.658    454.94  537.80  594.22  641.03  756.15  % PS
 613.791   86.946    457.38  536.11  612.13  682.57  773.82  % PSC
 548.928   62.044    452.66  502.75  528.83  594.88  679.32  % PSA
 537.460   69.338    430.64  482.47  523.46  584.25  706.65  % PSAC
 552.189   86.564    405.80  488.26  524.06  611.01  747.64  % PSCR
 472.278   82.941    329.21  416.97  458.23  522.38  678.32  % PSACR=ANCHOR
------------------------------------------------------------
 562.140   77.642    426.63  502.75  550.43  615.93  729.16


%%% Repeated-measures analysis of variance
%   The model-by-subject interaction serves as the error term
%
 model=repmat([1:7],40,1); IVs=[model(:),repmat([1:40]',7,1)];
 [SS,df,MS,lbl] = anova(BICcr(:),IVs,'MS');

Partitioning the sum of squares...
Source         SumSq   eta2[%]     df        MeanSq
---------------------------------------------------
   M      620999.764    27.16       6   103499.9607
   S     1312663.857    57.41      39    33658.0476
  MS      352901.529    15.43     234     1508.1262
 err           0.000     0.00       0        0.0000
Totl     2286565.150   100.00     279     8195.5740
---------------------------------------------------

 F=MS(1)/MS(3) , p=1-fcdf(F,df(1),df(3))
F = 68.6282
p =  0

 s_err = sqrt(MS(3)/40)
s_err = 6.1403

 CI95=s_err * tinv(.975,df(3))
CI95 = 12.0973

