REMACRB:
REpeated Measures Analysis for Complete Data
from Randomized Block experiment
User Guide
by
Ji Zhang, Bruch Schaalje, Sastry G. Pantula and Kenneth H. Pollock*
North Carolina State University
*
This research is partially supported by U.S. Fish and Wildlife Service,
Patuxent Wildlife Research Center, Laurel, Maryland (Research Work
Order No. 13). Also, Dr. Pantula's research is partially supported by NSF
(Grant No. DMS8610127).
REMACRB:
REpeated Measures Analysis for Complete Data
in Randomized Blocks
USER GUIDE
1. Introduction
This program (REMACRB) is written in SAS IML and is for use with repeated
measures data in which:
1.
observations are taken at the same time points for all
individuals,
2.
all individuals have a complete set of observations,
3.
the experiment is arranged in complete blocks, and
4.
the blocking factor is random.
REMACRB is not extremely user friendly.
up design matrices for linear models.
manipulate data in SAS.
Users must understand how to set
They must also be able to input and
The program uses estimated generalized least squares
(egls) as opposed to maximum likelihood in fitting models.
The general model considered by REMACRB is
where
Yilk is the observation in the ith block for the lth
treatment at the kth time point,
G
is a 1xP row vector of constants defining the
ilk
linear model for the mean of Yilk'
u
i1k
is the error term for the observation with
Page 2
where b ik and wilk are independent errors
associated with the block and individual,
respectively, at time k,
is a Px1 column vector of unknown parameters of
the linear model,
i = 1, ... ,A
1 = 1, ... , B
k = 1, ... , C
and
Blocks,
Treatments,
Times.
where E and E are C x C positive definite matrices.
w
b
column vectors Yil and Yi as
Yil
= (yi 11 ' ... , Yil C)
t
,
Thus if we define the
and
y.1 = (Y·,',···,Y·
)' ,
1
1 B'
and define G.,
1
U.,
1
and w. analogously, we have
1
Y ' = G.f) +
1
1
U.
1
where
Ui
= 1 ( Bx1)~ i + w.1
and
E
= I(B)0Ew +
u
NID(O, E ),
u
In the above paragraph and throughout this Guide 0 denotes the Kronecker
product, I(N) denotes an identity matrix of order N, J(N) denotes a NxN matrix
with all elements equal to 1, and 1(NX1) denotes an Nx1 column vector of 1's.
Page 3
We wish to model the covariance matrix E as E (9) which is a function of
u
a few unknown parameters.
u
The purpose of the program is to compute statistics
useful in determining the structure of
E ,
u
estimate the parametecs
(9)
with
their approximate standard errors, estimate the parameters of the mean model
with their standard errors, and test linear hypotheses involving parameters
(~)
of the mean model.
The program considers one model (user specified) for the mean
structures (supplied) for the covariance matrix
(G~),
and 6
The program consists of
u
three parts. The first part analyses the block means over time (Y • ), the
i k
second part analyses the deviations from block means over time (Yilk - y i.k ) ,
(E ).
while the third part combines the information from the first two parts to
obtain the final estimates.
The program assumes that the columns of the G
matrix are arranged in the following order:
where
Xik~I
includes all of the (fixed) effects corresponding to blocks, time,
and the block x time interaction;
treatment x time contrasts; and
any are present.
PO
x
1,
and PT x
= 0
Zilk~III
The dimensions of
1.
includes some or all treatment and
includes the effects of covariables if
~I' ~II'
and
~III
are, respectively, PC x 1,
We assume that the columns of H are such that
lk
B
L Hlk
1=1
Hlk~II
for k
= 1, ... , C•
If a column of H does not sum to zero over the treatments it is included as a
lk
column of Zilk' This problem does not arise when we consider only treatment
and treatment x time contrasts of a balanced design.
Page 4
The program REMACRB uses the program REMAC in various parts.
(See
Schaalje et al (1987) for the REMAC program.)
PART I.
Consider the block means over time,
Yi • k
-w •
= Gi.k~
+
= Xik~I
+ Zi.k~III + c ik '
b ik
+
i k
where c., = (c·, 1 ' ... ,c., c )' - NID(O, Ec )'
Note that the sums of the columns of the design matrix
involving treatment and treatment x time contrasts
(H. k ) are zero.
Thus we can delete these columns from
the design matrix.
PART II.
Consider the deviations from the block means over
time,
-
Yilk - Yi • k = (G ilk -
Gi.k)~ +
,
wilk - wi • k
,
Defining d. similar to y., we have
d., _ NID(O, [I(B) since Ed
J(B)/B]~E
= var(d il ) = var(w il
w)
- wi.)
= (1 - 1IB )E '
w
and Cov(dil,d ij )
1
=B
Ew for
1 not equal to j.
Note that the block and block x time effects do not
enter into this part of the model.
Page 5
PART III. In parts I and II, the estimates E and Ed of E and
c
c
Ed are obtained. The estimates of E , E and E are
w b
u
then obtained as,
Ew = [B/(B-1)]E
d
Eu =
I(B)~Ew
+
J(B)~Eb
If PT=O then the estimates of
~I
and
~II
and II are used as the final estimates.
~III
from parts I
In this case
does not enter any of the models considered and
hence the estimation is completed.
final set of estimates for
~I
=
(~I"
However if PT>O, a
~II"
~III')
is
obtained by regressing
A
EU
-1/2
A
y. on
1
-1/2
~
L.
U
6 1. •
Note that E -1/2 = I(B)~E -1/2 + B-1J(B)~[(BE )-1/2 _ E -1/2].
u
Ed.
w
c
w
In this program we consider six different covariance structures for E and
c
Both E and Ed are assumed to have the same structure. The six covariance
c
structures are as follows:
1.
unstructured model - If there are t repeated observations
for each experimental unit, this structure has C(C+1)/2
parameters, the maximum number that could be considered for
a symmetric matrix.
In the output from the program, the
estimates for these parameters are printed in a row composed
of the first row of the covariance matrix, followed by the
last C-1 elements of the second row, followed by the last
C-2 elements of the third row, etc.
Page 6
2.
banded or general stationary model - This model requires
all elements within any diagonal of the matrix to be equal.
Thus it has C parameters, and all stationary autoregressive
and moving average models are special cases of this model.
The output prints the first row of the estimated covariance
matr.ix.
3.
AR(1)
structure similar to the model described in Pantula
and Pollock
(1986) -
Here u
ilk
' the random error associated
with the kth observation of the lth treatment in the ith
block is assumed to be the sum
where
and
Here,
*, E.
- ,.k
= &Ik+
N
2
NAR ( 1 )( 0' , ex
s
of each other.
s
),
(Note that a
N
jk
a j1
=a
e
a
=~
a
jk
where e
j1
Page 7
NAR(1)(a2,~) denotes
, and
_ + a(1_~2)1/2 e
jk 1
jk
NID(O, 1) and
jk
for k > 1,
1~1<1.)
In PART I,
Yi • k
= G.,. k~
+
v.* +
°ik
,
, = v., + T.-,.
where v.*
Hence, using the REMAC program, we can estimate
*2
2
2
2
a v = (av + a T IB, as'
~s)'
In PART II,
Hence, using the REMAC program, we can estimate
([1-1/B]a~ , [1-1/B]a~ , ~E)
•
The number of parameters for this structure is thus 3 for
each part. The output prints a row consisting of the three
estimates of the above parameters. If the estimate of the
first component is negative, the program simply sets it to
zero. If the absolute value of the estimate of
~
is greater
than 1, the estimate is set to (sign of the estimate of
~)*O.995.
Page 8
4a. simple AR(1) structure - This is a special case of model 3
with o~ and o~
= O.
When the estimate of o~ or o~ is
set to zero in structure 3 because of a negative estimate,
the estimates of the second and third components under
structure 4a are generally better than the estimates
obtained under structure 3. Estimates of
~
which are greater
in absolute value than 1 are treated as in structure 3
above.
4b. split plot structure - This is the structure assumed by the
split plot analysis of variance where time is treated as the
subplot treatment. It is also a special case of model 3 with
~
s
=0 and
~
E
=0.
Thus the structure has 2 parameters in each
of the two parts. If the estimate of the first component is
negative, the program simply sets the estimate to zero.
5.
ordinary least squares structure - In ordinary least squares,
the covariance matrix is assumed to be of the form
each part.
o2
~
= O.
0
This is a special case of model 4b with
2
1 in
0
2
and
v
Similar to the relationship between models 3 and 4a,
2 or 0 2 under structure 4b has been
v
~
set to zero the estimate of 0 2 or 0 2 under structure 5 is
s
E
2
2
generally better. Only 0 or 0 is estimated and printed
s
E
when the estimate of
0
out in each part, respectively. They are called o~ in the
first two parts.
(See Jennrich and Sch1uchter (1986) and Pantula and Pollock (1986) for more
information on these structures.)
Page 9
2. Use of the Program
In order to use the program, the user must first use whatever system
commands are necessary to execute SAS.
Within SAS, the user must input his
data in a DATA step and take whatever steps are necessary to ensure that the
data are sorted so that all of the observations for each individual are
together and occur in the correct time sequence.
The program, which invokes
the IMl procedure, is then inserted after the data step, and the data are read
into a matrix called VA.
The user must supply the names and values indicated by lower case letters
for the following sequence of commands near the start of the program:
A = a;
B = b;
C = c;
P = p;
PC = pc;
PO = pd;
MAXIT =. i;
TEST = h;
R = an h X 1 column vector
H = a matrix ;
Dl = a column vector ;
*---
READ IN DATA VALUES AND SET UP YA
N = A*B;
T = C;
PT = P - PC - PO;
NT = N*T;
VA = J(NT,cola);
USE name;
READ ALL INTO VA;
YA = YA(I ,colbl)i
where:
Page 10
a
= number
of blocks
b
= number
of treatments
c
= number
of observations for each individual
p
= number
of parameters in the mean model
pc
= number
pd
= number
i
= number
h
= number
cola
= number of variables in the data set
= name of the SAS data set containing
of parameters in the mean model which do
not involve treatments
of parameters in the mean model which do
not involve blocks but involve treatments and
treatment x time interactions
of iterations desired for iterative
estimates of the parameters of the covariance
structures (i>O) - it should not be necessary to
set i greater than 16.
of linear hypotheses involving parameters
of the mean model to be tested in the program
name
the sorted
data
colb
= position
in the data set of the variable which
is to be analysed.
The user must set up the ABCxP model matrix (called GA in the program) of
the mean model (recall the order in which the columns of GA should be
arranged).
In the current program, this matrix must be of full rank.
The
matrix can be set up in the DATA step using, for example, statements of the
form
GA1
= (TRT = 1).
It can also be set up in the IMl step using the ORPOL, HDIR, and DESIGN
functions. (See examples to follow for illustrations on the use of these
commands.)
Page 11
The vectors Rand DL and the matrix H are arrays which must be set up in
order to carry out hypothesis tests involving parameters of the mean
mode~.
R
is a column vector giving the degrees of freedom for each of the_hypothesis
tests.
If we wish to test the hypotheses
and
we would vertically append K, and K into the matrix H and similarly append
2
., and -2 into the vector DL.
3. What the Program Does
In the first two parts, after initially fitting the mean model to the data
using ordinary least squares, the program computes a pooled estimate of the
covariance matrix using the residuals.
Based on this estimated covariance
matrix, the mean model is again fit using the eg1s procedure.
A second pooled
estimate of the covariance matrix is then obtained as before using the eg1s
residuals.
Taking the elements of the estimated unstructured covariance matrix as the
observed data, eg1s and estimated generalized nonlinear least squares are used
(as appropriate) to estimate the parameters of the covariance structures 2, 3,
4a, and 4b as described above.
The standard errors of the estimates of the
variance-covariance parameters are also computed.
Using each of the estimated
covariance matrices, egls is again used to get the estimates (and the estimates
of the standard errors) of the parameters of the mean model.
Page 12
In PART III the results from the first two parts are combined to compute
the final Chisquare and Lambda statistics, the estimates for the mean model
(using egls) with their stardard errors, and the values of the test statistics
for the linear hypotheses.
The program also computes the estimates for the
parameters of the PANTULA-POLLOCK AR(1) model and their approximate standard
errors.
The estimates for other covariance structures are also computed.
4. Output From the Program
Printed output for PART I and PART II includes estimates of the parameters
of the covariance structures (the parameter estimates that are printed out in
each case are described in the introduction) and the corresponding egls
estimates of the parameters of the mean model.
for all of the estimators are also printed.
Estimates of standard errors
In addition, for each covariance
structure the output includes the number of parameters fit, the residual sum of
squares, minus two times
t~elog
of the likelihood computed at the estimated
parameter values, and two chisquare statistics helpful in comparing the fit of
the data to the various covariance structures (Fuller 1987, chapter 4).
Values
of the statistics for testing hypotheses involving the mean model are printed
with their degrees of freedom.
These can be evaluated by referring to
appropriate tables of chisquare percentiles.
The program also computes estimated standard errors of the ordinary least
squares estimates of the parameters of the mean model, under different
structures of the covariance matrix. Similarly, it computes and prints values
of the statistics for testing specified hypotheses based on the ordinary least
squares estimates of the parameters of the mean model but using different
estimates of the covariance
~tructure.
These statistics are useful because the
Page 13
ordinary least squares estimator is the only linear unbiased estimator
considered in this program and may have desirable small sample properties not
shared by the egls estimates.
The final printout for PART III
Lambda statistics, the estimates of t
consists of the combined Chisquare and
b
and their minimum eigenvalues.
A typical set of output from the program is:
Page 14
THE RESULTS FOR PART I
THE RESULTS
--
FOR~==
BLOCK MEANS OVER TIME
UNSTRUCTURED MODEL
THE RESIDUAL SUM OF SQUARES
RSS
49.7735
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
E:>--_....:>~
(c.)(c.+ 1)
1"
Pc. + Y T
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
2.9909
0.7281
-0.0247
-0.0230
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
Hen~. -th-e.r-e.
50
SEB
~0472
0.0239
0.0171
Bm.
O.~
THE ESTIMATES OF THE PARAMETERS FOR
TH
0.0221
0.0228
0.0234
0.0177
0.0278
0.0264
0.0285
0.0221
0.0305
0.0239
0.0239
A
ot
,
L
~1)
...
'IS
Page 15
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
0.0103
0.0106
0.0108
0.0112 0.009301
0.0124
0.0121
0.0106
0.0124
0.0129
0.0107
0.0136
0.0114
0.0107
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0231
0.0221
0.0228
0.0234
0.0177
0.0221
0.0280
0.0265
0.0269
0.0213
0.0228
0.0265
0.0278
0.0286
0.0221
0.0234
0.0269
0.0286
0.0306
0.0240 "
0.0177
0.0213
0.0221
0.0240
0.0240
Y'e~"l JIA~ls
e<j ls
whtY'"~
2:(1)
..1\
<:..
THE MINUS TWO LAMBDA STATISTIC
LAM
G28.9Y
0\5
-~ l( fl.-'1:U} flllt. elt) )
,.1\
)\ (1)
~
THE CHISQUARE STATISTICS
FOR~~==
THE RESIDUAL SUM OF SQUARES
RSS
49.8186
IO«j
BANDED MODEL
of {he..
likel'lkoocA ~V~\"'OI. t eJ. q.:t
)\ (t>
A,,)
ec_-=--_~,,("''''~s
THE RESULTS
-:;l ~
~
CHI2
CHI1
:
tv-
I
~ TIl.
I
~V\A
~
(1)
C7 <-
",,~i: riAL+lAV'tA W'\o~ e-\
Page 16
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.7286
-0.0191
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0274
O.01630~
.A
Se.
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
0.0226
0.0212
0.0201
0.0187
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
.A
.0096544 .0096336 .0096383 .0097307
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0248
0.0226
0.0212
0.0201
0.0187
0.0226
0.0248
0.0226
0.0212
0.0201
0.0212
0.0226
0.0248
0.0226
0.0212
0.0201
0.0212
0.0226
0.0248
0.0226
0.0187
0.0201
0.0212
0.0226
0.0248
Se
Page 17
THE MINUS TWO LAMBDA STATISTIC
LAM
.A
~ ~
"'\
~ -:2 A
(
R_~('&J
I~ ...
e~~)
)
J -
THE CHISQUARE STATISTICS
CHI1
CHI2
88.7478
THE RESIDUAL SUM OF SQUARES
RSS
49.8115
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
3+
PC + 'PT
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
0.7286
-0.0191
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEe
0.0278
0.0179
0.0139
Page 18
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
0.0125 .0086255
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0251
0.0229
0.0213
0.0201
0.0192
0.0213
0.0229
0.0251
0.0229
0.0213
0.0229
0.0251
0.0229
0.0213
0.0201
0.0201
0.0213
0.0229
0.0251
0.0229
0.0192
0.0201
0.0213
0.0229
0.0251
THE MINUS TWO LAMBDA STATISTIC
LAM
THE CHISQUARE STATISTICS
CHI1
CHI2
~132
THE RESULTS
10.~ 'X:(£~).J
FO~=
SIMPLE AR(1) MOOEL
Page 19
THE RESIDUAL SUM OF SQUARES
RSS
49.8056
THE NUMBER OF PARAMETERS IN THIS MODEL
J+ pc.
-to
PT
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
A
0.0315
0.0177
se
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
G_02_~_6__0_~_9_12_2
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
G94107
O.O~
Page 20
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0246
0.0224
0.0205
0.0187
0.0170
0.0224
0.0246
0.0224
0.0205
0.0187
0.0205
0.0224
0.0246
0.0224
0.0205
0.0187
0.0205
0.0224
0.0246
0.0224
0.0170
0.0187
0.0205
0.0224
0.0246
THE MINUS TWO LAMBDA STATISTIC
LAM
A
~
J
&(~»)
I< (.. >
1= m. J
-t
THE CHISQUARE STATISTICS
CHI1
CHI2
(.7:71l
~56
THE RESULTS
~ V,~
(~~t)
•. ~c.(IfoA))
~
L~
10.51~~
FOR~~=
SPLIT-PLOT MODEL
THE RESIDUAL SUM OF SQUARES
RSS
49.8629
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
,
y
Page 21
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.7286
(
-0.0201
A
c...)
-:t
~
(ttl.)
-lIt
)'
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0177
0.0177
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
~
o.0235
_
~
.00JU06
_
.l\e(".)
=_
(
-c.
~
A
n-
+
\J"
.1\ )B
~
VT
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0267
0.0235
0.0235
0.0235
0.0235
0.0235
0.0267
0.0235
0.0235
0.0235
0.0235
0.0235
0.0267
0.0235
0.0235
THE MINUS TWO LAMBDA STATISTIC
LAM
0.0235
0.0235
0.0235
0.0267
0.0235
0.0235
0.0235
0.0235,
0.0235
0.0267
1.
.1\)
r'T"" 1.
,\J
s
Page 22
THE CHISQUARE STATISTICS
CHI1
CHI2
~8
11.59~
THE RESULTS FOR <6§EL9= ORDINARY LEAST SQUARES MODEL
THE RESIDUAL SUM OF SQUARES
RSS
50.0000
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
~
1+'Pc..
+PT
THE ESTIMATES OF ·THE PARAMETERS FOR THE MEAN OF THE MODEL
§z
IJ m
BETA
0.7286
-0.0201
(
1\
($')
)\
($")
)
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0516
0.0516
A
Se...
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
e
A
(S)
_ c
_
I
Page 23
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
~
(e~~) )
1\
.A
se
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0266
0
0
0
0
0
0.0266
0
0
0
0
0
0.0266
0
0
0
0
0
0.0266
0
/\ (~)
Ie.:
0
0
0
0
0.0266
THE MINUS TWO LAMBDA STATISTIC
LAM
a1\ (,.)
oC39.41~
A
(f> )
fT'
_c.
J~TiL
THE CHISQUARE STATISTICS
CHI1
CHI2
:=r
~-----28714.1
79.75:'
_
_
y..
.1\
').(,(\)11'
L
I
c,}
1\
~('»)
L
C.
1\
~
a
I
Page 24
THE OLS ESTIMATES FOR THE MEAN OF THE MODEL AND THEIR STANDARD ERRORS UNDER DIFF
ERENT COVARIANCE STRUCTURES
BETA
COL1
SEB01
COL1
(j~,~)
Sc.
A
~(1~,)
_~
-t!
Q\SS"'...... Cj
/ ' If)
~S~ '"'.... ~,,~
J\
~iJl
COL1
COLi
~(f1
e:>J
SEB04A
COL1
Lt." L~"
SEB04B
2. r. ~ f:~)
COL1
COL1
:~( 0.'' )
~ (~I(S-)
1
~ (~)
)
(f)
I~TJj
-I!L
~S)",... ~'" ~
.1\
2=~:: ~~~)
THE RESULTS FOR PART II
THE RESULTS
DEVIATIONS FROM THE BLOCK MEANS OVER TIME
FO~=
UNSTRUCTURED MODEL
THE RESIDUAL SUM OF SQUARES
RSS
99.1519
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
~
PD
+
PT
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.0215
0.0163
(~;')
~
(1\
-IiI.
0.0306 -.001676 -.008124 .0031729
(Ih thIs
tke~~
C\~~
~a 15
rOlr~·1
\'"\0
CV\\(A"
Co
€Y\'\pt'j)
t.l<OI'V'lflt)
VfA.,.; ~ I~
(71.
so
Page 25
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
.1\
se..
SEB
0.0231 .0077098
0.0134 .0053387 .0092468 .0043073 .0074605
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX A .
A
0
ot
(I)
~cA :: YH';'1- "'~ el~"",~",,-\s
TH
\
(I)
LJ..
0.0124 .0099018
0.0104
0.0103 .0080041
0.0128
0.0109
.0091733
0.0127
0.0124
0.0100
0.0138
0.0108
0.0105
0.0118
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
( G~) )
SETH
.0032144 .0029271 .0029742 .0030423 .0025485 .0032975 .0030548 .0032427
.0026976 .0032738 .0033174 .0027903 .0035688 .0029502 .0027123
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0125 .0098846
.0098846
0.0129
0.0104
0.0109
0.0118
0.0103
.0080001 .0091958
0.0104
0.0109
0.0126
0.0125
0.0100
0.0103 .0080001
0.0118 .0091958
0.0125
0.0100
0.0138
0.0108
0.0105
0.0108
THE MINUS TWO LAMBDA STATISTIC
LAM
~
~
e
(I)
I?. III"
(I) )
}
- cA
Page 26
THE CHISQUARE STATISTICS
CHIl
CHI2
O:J-r O\IW~jS
~
THE RESULTS
FOR~==
2f""O
t
y'"
~
IA V\So
t ~'" t't ~ J..
1..\ .,.
'MoJ~\
BANDED MODEL
THE RESIDUAL SUM OF SQUARES
RSS
99.4876
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
~
THE· ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.0259
0.0215
0.0161
0.0306 -.003004 -.008163 .0062527
0.0129
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0226 0.008068
0.0140 0.004934 0.008546 .0047315 .0081951
~(&;)'
1
(1.)
~r11..
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
0.0102
Page 27
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0120
0.0102
0.0102
0.0120
0.0101
0.0102
.0091898
0.0101
.0085669 .0091898
0.0101 .0091898 .0085669
0.0102
0.0101 .0091898
0.0120
0.0102
0.0101
0.0102
0.0120
0.0102
0.0101
0.0120
0.0102
THE MINUS TWO LAMBDA STATISTIC
LAM
A
~ (~)
/\
0- (w)
1~7JI
1
.... 0\.
THE CHISQUARE STATISTICS
CHI2
CHI1
CS?294
THE RESULTS
FOR~=
THE RESIDUAL SUM OF SQUARES
RSS
99.3976
~
9.9025
X (2:"J..).. ~
l~
C-rA
1.
A
(I)
/\
))
I
PANTULA-POLLOCK AR(1) MODEL
Page 28
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
~ 3+PD *'PT
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.0215
0.0161
0.0306 -0.00483 -.008216 .0062527
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0230 .0071099
0.0123 0.006121
0.0106 .0054428 .0094273
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
~3357
6.1E-04
O~
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0105 .0099756 .0098105 .0097599
0.0123
0.0105 .0099756 .0098105
0.0123
0.0105
0.0105
0.0123
0.0105 .0099756
.0099756
0.0105
0.0123
0.0105
.0098105 .0099756
0.0123
0.0105
.0097599 .0098105 .0099756
)'
(
~.)
~~)
Page 29
THE MINUS TWO LAMBDA STATISTIC
LAM
e-/\. (~) )
-~
THE CHISQUARE STATISTICS
CHI1
CHI2
~, V,"'
~
(\ l.( ~~').)
L"\
t:-lI\~\) )
r;;;-:
~286
, THE RESULTS
14.15~
FOR~==
SIMPLE AR(1) MODEL
THE RESIDUAL SUM OF SQUARES
RSS
99.2376
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
~ ;)+PD
+ PT
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.0215
0.0161
0.0306 -.005521 -.008236 .0062527
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0218
0.0109
0.0190 .0064475
0.0112 .0049254 .0085311
Page 30
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
O.85~
e(If.. ) =(
~
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
E75
O.03~
A
Se...
(1\t! (If,.»)
-tA
THE ESTIMATED COVARIANCE MATRIX
SHAT
0.0119
0.0102 .0087868 .0075364 .0064639
0.0102 .0087868 .0075364
0.0119
0.0102
0.0119
0.0102 .0087868
0.0102
.0087868
0.0102
0.0119
0.0102
.0075364 .0087868
0.0119
.0064639 .0075364 .0087868
0.0102
THE MINUS TWO LAMBDA STATISTIC
THE CHISQUARE STATISTICS
CHI1
~
~15
THE RESULTS
CHI2
22.026~
FOR~DEL~=
XI~(~~)~}~{~,j)
L-~
~~
SPLIT-PLOT MODEL
Page 31
THE RESIDUAL SUM OF SQUARES
RSS
99.5505
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
~
~+'PD
+PT
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
BETA
0.0215
0.0161
0.0306 -.004024 -.008192 .0062527
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0232 .0059101
0.0102 .0059101
0.0102 .0059101
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
~4.00209~
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
G-O-~0-0"";-4-1-2-3-.-3-~
(I--U
)
~~)
Page 32
THE ESTIMATED COVARIANCE MATRIX
0.0125
0.0104
0.0104
0.0104
0.0104
0.0104
0.0125
0.0104
0.0104
0.0104
0.0104
0.0104
0.0125
0.0104
0.0104
0.0104
0.0104
0.0104
0.0125
0.0104
0.0104
0.0104
0.0104
0.0104
0.0125
THE MINUS TWO LAMBDA STATISTIC
LAM
~
7' -;J
~
A (J~~~)J
~(H)
/::nr
J
§tA(~) )
THE CHISQUARE STATISTICS
CHIl
~
~75
CHI2
.1\
.1\
~ X,2.("'~)"'tt)~~'ib)
Lv\.
~u...
15"535~ (
THE RESULTS FORQ£ODEL-~= ORDINARY LEAST SQUARES MODEL
THE RESIDUAL SUM OF SQUARES
RSS
100.0
THE NUMBER OF PARAMETERS IN THIS MODEL
NPARA
Goooo~ 1 1" 1'D
+
PT
)
Page 33
THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL
(kin)'
BETA
0.0161
0.0215
0.0306 -.004024 -.008192 .0062527
/1("
~iIr
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SEB
0.0144
0.0112
0.0144
0.0249
0.0249
0.0144
0.0249
~e;)
/I (f"J
~rIl.
THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX
TH
THE STANDARD ERRORS FOR THE ABOVE ESTIMATES
SETH
G168~ ~
(t1<l)
THE ESTIMATED COVARIANCE MATRIX
SHAT
o
o
o
0.0124
o
o
0.0124
o
o
o
o
o
o
o
o
o
o
0.0124
o
0.0124
THE MINUS TWO LAMBDA STATISTIC
LAM
~
~ (
-;;) A(~~)
/:::!':J..
~
J
(T)
I~!JI.
J
~(S-»)
£"1\
.1\
~rA(7)
L
_- (
I-i) ~~ I
.1\
Page 34
THE CHISQUARE STATISTICS
CHI2
THE OLS ESTIMATES FOR THE MEAN OF THE MODEL AND THEIR STANDARD ERRORS UNDER DIFF
ERENT COVARIANCE STRUCTURES
BETA
COL1
SEB01
COL1
SEB02
SEB03
COL1
~()
A~S""'"''
4\U",,,, i "'j
SEB04B
s1(o)
o.sSlAMi ..~
-1\
('tA)
2:c*
COL1
SEB05
~~~)
THE RESULTS FOR PART III -- THE COMBINED STATISTICS
***---&&&---***
'1 (~)
2:tA
COL1
~() .0064408
0.0112
0.0144
~ (~)
0.0249
r~ 0.0144
0.0249
0.0144
0.0249
(-)
'U}I..\W\OIi",,~
.J\
2:t)
COL1
~
st (.)
-1\
SEB04A
COL1
51c·)
GUSlA .... , .. ~
A
(s-)
2:J.
Page 35
THE LINEAR HYPOTHESES TEST STATISTICS AND THE BETAS USED IN THESE TESTS
lest
HTEST1
~oV'" ~
-rho(. ~ i rd:
stlA. tistjc!>
U1 ~ = ~ l '
"".~s -t~e. e<3 ls e" ti~Il'.{t. e.th ;It {:"'~ s e ~ 1'\ A. )
1: ( A (r-)
(t») I.1.St~ t~ c. ols es ~'IW\'"tf.. .
"
~ I
~
i:.
BETA1
2.9911
0.7281 -0.0249 -0.0229
-.001454 -.008118 .0028819
0.0128
0.0237
0.0215
0.0163
0.0239
0.0170
0.0144
0.005201 .0090085
0.0163
0.0283 .0094424
0.0492
0.0239
0.0190
0.0159
0.0104
0.0119 .0060062
0.0164
0.0284 .0094442
SEB1
SEB01
HTEST2
cro;.2
3.2324
9.5408
70~ T:1 (
3.1929
9.7125
T(~
....,
~(~
I:::'
J
2.
(f")
/:::.)
0.0164
i: (I.))
.,
BETA2
2.9834
0.7286 -0.0191 -0.0267
-.008163 .0062527
0.0129
0.025~
0.0215
0.0161
0.0306
0.0469
0.0274
0.0163
0.0144
0.0105 .0057948
0.0100
0.0160
0.0277 .0098812
0.0171
SEB2
.0060429
Page 36
SEB02
.0061277
0.0469
0.0274
0.0165
0.0144
0.0106 .0057948
0.0100
HTEST3
/\
0.0160
.1\
"'"
tv
0.0277 .0098812
)
704.~ ~ Il ) L",
c::ro:l
-::3-.~08~4~0'---3-=--".0~9~5~211.8747 11.7394
(
(l)
BETA3
2.9833
0.7286 -0.0191 -0.0267
-0.00483 -.008216 .0062527
0.0129
0.0257
0.0215
0.0161
SEB3_-----------------------0.0471
0.0278
0.0179
0.0139
0.0130 .0066661
0.0115
0.0163
0.0281 .0087078
0.0471
0.0278
0.0181
0.0139
0.0130 .0066661
0.0115
0.0163
0.0281 .0087078
SEB03
.0075308
HTEST4A
~.O
5~~(J(~~) i:~~») G.(~(»Jt~~~»)
-:3--.-:-4~40:-:2:---3~.:...,4~4~2?2
8.2197
I
7.9744
BETA4A
2.9833
0.7286 -0.0190 -0.0267
-.008236 .0062527
0.0129
0.0257
0.0215
0.0161
0.0462
0.0315
0.0177
0.0134
0.0137 .0060324
0.0104
0.0154
0.0267
0.0134
A( ...)
~
SEB4A
0.0232
. ., (~C'fol ,
s~
-
J
Page 37
SEB04A
0.0462
0.0315
0.0179
0.0134
0.0138 .0060324
0.0104
HTEST4B
~. 7
1693.
i::>7 T.; (~/..)
~--::3:-."""""O""'9'---3:=--::.0:-:::3:'::0-=-9
13.4479 13.4479
0.0154
0.0267
0.0134
0.0215
0.0161
0.0232
f.,..))
J
lII.
BETA4B
2.9833
0.7286 -0.0201 -0.0267
-.008192 .0062527
0.0129
SEB4B ~
.0072384
0.0257
- - - - - - - - - - - - - - - - - - - -_ _
0.0492
0.0177
0.0177
0.0177
0.0125 .0072384
0.0125
0.0164
0.0284 .0072384
0.0125
Page 38
SEB05
0.0516
0.0516
0.0516 .0078884
0.0176
0.0306
0.0137
0.0176
THE VARIANCE-COVARIANCE MATRIX = I(B)@SHATW+J(B,B,1)@SHATB,
WHERE SHATW=SHAT*B/( B-1)
SHAnB
0.0169
0.0172
0.0176
0.0183
0.0137
0.0172
0.0215
0.0210
0.0210
0.0167
0.0176
0.0210
0.0215
0.0224
0.0171
0.0137
0.0167
0.0171
0.0186
0.0187
0.0183
0.0210
0.0224
0.0237
0.0186
MEB1
~
A
(I)
2:b
_
-
L
A
E5E-~
. . . . . ;,,;""''''flt' ~ i~etwr.I~t.
o-f.
~~)
SHAT2B
0.0188
0.0175
0.0162
0.0155
0.0144
0.0175
0.0188
0.0175
0.0162
0.0155
0.0162
0.0175
0.0188
0.0175
0.0162
0.0155
0.0162
0.0175
0.0188
0.0175
0.0144
0.0155
0.0162
0.0175
0.0188
0.0177
0.0190
0.0177
0.0163
0.0152
0.0163
0.0177
0.0190
0.0177
0.0163
0.0152
0.0163
0.0177
0.0190
0.0177
0.0143
0.0152
0.0163
0.0177
0.0190
A
~(~)
b
MEB2
4.6E-04
SHAT3B
0.0190
0.0177
0.0163
0.0152
0.0143
MEB3
6.4E-04
7
L
/\
0.)
b
el)
~
-
~}
~-\
A
LeI)
J.
Page 39
SHAT4AB
0.0186
0.0173
0.0161
0.0149
0.0138
0.0173
0.0186
0.0173
0.0161
0.0149
0.0161
0.0173
0.0186
0.0173
0.0161
0.0149
0.0161
0.0173
0.0186
0.0173
0.0138
0.0149
0.0161
0.0173
0.0186
0.0184
0.0204
0.0184
0.0184
0.0184
0.0184
0.0184
0.0204
0.0184
0.0184
0.0184
0.0184
0.0184
0.0204
0.0184
0.0184
0.0184
0.0184
0.0184
0.0204
('icJ
.1\
'2:'
b
MEB4A
7.4E-04
SHAT4BB
0.0204
0.0184
0.0184
0.0184
0.0184
f-
(lib)
b
MEB4B
.0020927
SHATSB
0.0204
0
0
0
0
0
0.0204
0
0
0
0
0
0.0204
0
0
0
0
0
0.0204
0
0
0
0
0
0.0204
/\
~(~)
b
MEBS
0.0204
THE MINUS TWO LAMBDA STATISTICS AND THE NUMBER OF PARAMETERS
LAM1
qv
-:> }(
A
1\
NP1
(
~.OOO~ d..
~ (I») 2~(1»)
C
(C.'O)
~
1"
pc.
i-
i'D
~?T
Page 40
NP2
LAM2
22.~ - J A( ~
Ea.1
LAM3
(I.)J
i:~~)
)
NP3
6
2. 7
-
"""
/\
16.000~
-374.a
_
6.9"0.7
_
~ ). (~ (If,,))
-)
NPS
LAMS
b+P(+PD~PT
NP4
LAM4B
LAM4A
..,
1a.~ -;).\ (fl. (J)I y-~J) )
14.0~
~
THE CHISQUARE STATISTICS
-)
>- (~")} Z",''')
~ ~ (~~)
(
J
A
2: :&t.,.»)
t
~Lf b) )
Lf + Pc + 1'1> +P T
CHI21
_____
-~ O\lwG\.~~
'Z.'f'l"O
CHI22
CHI23
24.36~~
_______
_- ~ V
C'-l
CHI24A
,(1))
.1\
~ (~(.)
CHI14B
~""
'"
I
L- V\
CHI24B
27.1~
CHI2S
Page 41
THE ESTIMATES AND STANDARD ERRORS OF THE PARAMETERS IN
THE PANTULA-POLLOCK AR(1) VAR-COV STRUCTURE
ESV
ROW1
ESD
COL1
SESV
COL1
En
ROW1
o.oV
Call
SESD
COL1
ROW1 ESS83
ROW1 . OO86
V
EALD
COL1
SEALD
Call
ROW1
~7;76
ROW1
COL1
SESG
ESG
ROW1
~146
ESEP
COL1
O.~
/\
s-e- (\f: )
A
A
se. (~). )
v
\f:l
s
1\
oJ.. s
ROW1 .OOS03V
q'
1:
EALEP
ROW1
COL1
E64
ROW1
SEALEP
ROW1
A
S(.
COL1
A
ROW1E.31
( 0(
COL1
A
SESEP
"'\
/\
Se
9.1EY
(Jt:2..
-
A
-1
\TJ.
s )
( q.L~ )
-'\
Se..- ( <J""e ~)
A
COL1
V
O. 17
""
O(~
'"'"
Se..-
.1\
(~6
)
Page 42
5. Inference Based on the Output
To determine the appropriate covariance structure, note that except for
structures 4a and 4b, the covariance models are hierarchical.
Tbat is, model 2
is a special case of model 1, model 3 is a special case of model 2, etc.
To
test the hypothesis, for example, that model 2 (with fewer parameters) fits the
data as well as model 1, subtract the (-2) log likelihood statistic for model 1
from that for model 2.
The resulting statistic has an approximate chisquare
distribution with degrees of freedom equal to
#
parameters for model 1 - # parameters for model 2.
A similar procedure could be done using the chisquare statistic suggested
by Fuller (1987).
As the sequence of comparisons (2 vs 1, 3 vs 2, 4a vs 3, 4b
vs 3, 5 vs 4a, 5 vs 4b) is carried out, one would stop as soon as one
comparison is significant.
For example, if the comparisons of model 4(both a
and b) to 3 is the first to be significant, model 3 would be selected as the
appropriate covariance structure.
When the estimate of
0
2 or
v
0
2 from model 3 is zero, the goodness-of-
T
fit statistics used to compare model 4a with model 3 may be negative, and the
tests cannot be carried out.
5 to model 4b.
A similar situation may arise in comparing model
In these cases, as mentioned previously, model 4a is preferable
to model 3 or model 5 is preferable to model 4b.
The above test procedures can also be applied to PART I and PART II
separately, which may be helpful in determining the final choice of a model.
Simulations have been carried out to verify the effectiveness of the
estimation procedures used in this program. The results of the simulations are
given as an example in the next section.
Page 43
Once the structure of the covariance matrix has been determined, the
program is useful in several ways for testing linear hypotheses concerning
parameters of the mean model:
1.
The GA matrix could be set up such that the parameterization
of the model involves the contrasts of interest.
The parameter
estimates with their standard errors are then directly useful in
testing single degree of freedom hypotheses.
2.
Full and reduced models could be fit on separate runs of the
program.
The (-2) log likelihood statistics can be used to
compute likelihood ratio test statistics with approximate
chisquare distributions under the null hypotheses.
3.
The covariance matrices of the parameter estimates could be
used to construct chi-square statistics for testing different
hypotheses.
These tests are done automatically on a single
run of the program by setting up the R, H, and DL arrays as
described previously.
Both procedures 2 and 3 are useful for multiple degrees of freedom tests,
but they will not necessarily give the same values for the test statistics.
6. Examples
Three examples will be given to illustrate the use of this program.
a. Lead Data
These data were received from the U.S. Fish and Wildlife Service and have
been described in detail elsewhere (Hoffman et al 1985).
Forty American
kestrel nestlings, 4 in each of 10 nests, were orally dosed with one of 4 lead
treatments every day for the first 10 days of their life.
One of the lead
Page 44
treatments was a control treatment. The experiment was a randomized block
design with nests as the blocking factor.
during the 10 days of treatment.
The birds were weighed every day
Because 6 of the 10 birds recejving the
highest lead treatment died before the end of the experiment, we worked only
with the other three treatments.
An analysis for the first five weights is
presented here.
The data were read in using the following commands:
DATA LEAD;
INPUT BLOCK TRT $ W1-W5;
DROP W1-W5;
ARRAY W(I) W1-W5;
DO 1=1 TO 5;
WGT=LOG(W); WEEK=I;
IF TRT NE '3' THEN OUTPUT;
END;
CARDS;
(the LEAD data set)
PROC SORT DATA=LEAD;
. BY BLOCK TRT WEEK;
DATA TWO;
SET LEAD;
KEEP WGT WEEK;
The relevant PROC IML commands necessary to read in the data, set up the
analysis, and create the arrays necessary in hypothesis testing as well as the
design matrix (GA) were:
A=10;
B=3;
C=5;
P=12;
PC=4;
PD=8;
MAXIT=15;
Page 45
TEST=3;
R={3,2,6};
H={O 1 0 0 0 0 0 0 0 0 0 0,
o 0 1 0 0 0 0 0 0 0 0 0,
o 0 0 1 0 0 0 0 0 0 0 0,
o 0 0 0 1 0 0 0 0 0 0 0,
o 0 0 0 0 1 0 0 0 0 0 0,
o 0 0 0 0 0 1 0 0 0 0 0,
o 0 0 0 0 0 0 1 0 0 0 0,
o 0 0 0 0 0 0 0 1 0 0 0,
o 0 0 0 0 0 0 0 0 1 0 0,
o 0 0 0 0 0 0 0 0 0 1 0,
o 0 0 0 0 0 0 0 0 0 0 1};
DL={O,O,O,O,O,O,O,O,O,O,O}; STORE H DL R;
*--- READ IN DATA VALUES AND SET UP YA
---i
N=A*B;
T=C;
PT=P-PC-PDi
NT=N*T;
YA=J(NT,2);
USE TWO;
READ ALL INTO VA;
YA=YA( I ,11);
*--- SET UP GA MATRIX---;
GA=J(NT,P,O);
VEC=1:T;
PP=ORPOL (VEC, T) ;
DO 1=1 TO NT;
GA(II,ll)=l;
JJ=MOD( I, T) ;
IF JJ=O THEN JJ=T;
GA(II,21 )=PP( IJJ,21);
GA(II,31 )=PP(IJJ,31);
GA ( I I ,41 )=PP ( I JJ , 41 ) ;
II=INT((I-1)IT)+1;
JJ=MOD ( II , B) ;
IF JJ=l THEN DO; GA( 11,51 )=2; GA(II,61 )=0;
IF JJ=2 THEN DO; GA(II,51 )=-l;GA( 11,61 )=1;
IF JJ=O THEN DO; GA(II,51 )=-l;GA( 11,61 )=-1;
DO II=l TO 3;
DO JJ=1 TO B-1;
KK=(II-1)*(B-1)+JJ+6;
GA(II,KKI )=GA( 11,11+1 I )*GA( II,JJ+41);
END;
END;
END;
FREE VEC PP;
END;
END;
END;
Page 46
The mean model included a general mean, a cubic polynomial for the time
points, two contrasts for the three treatments, and the interactions between
the treatment contrasts and the time points.
The hypothesis
tes~s
were similar
to ANOVA tests for the time and treatment main effects and also the interaction
effects.
The output was given in section 4. The following statistics from the
output are useful:
I.
MODEL
PART I. --- BLOCK MEANS
LAMBDA
CHI2
p-VALUES
#p
LAMTEST
CHI2TEST
UNSTRUCT
-128.9
o
BANDED
-115.5
9.56
9
.10+
.10+
P-P AR(1)
-115.1
10.21
7
.10+
.10+
SlM AR(1)
-114.9
10.51
6
.10+
.10+
S-P MODEL
-109.9
11.59
6
.01+ *
.10+
OLS MODEL
-39.42
79.75
5
II.
MODEL
PART II.
LAMBDA
19
**
**
DEVIATIONS FROM THE BLOCK MEANS
CHI2
p-VALUES
#p
LAMTEST
CHI2TEST
UNSTRUCT
-287.9
o
23
BANDED
-276.2
9.90
13
.10+
.10+
P-P AR(1)
-271.1
14.16
11
.05+
.10+
SIM AR(1)
-266.2
22.03
10
.025+
S-P MODEL
-268.5
15.54
10
.10+
.10+
OLS MODEL
-154.9
141.1
9
**
**
*
**
Page 47
III.
PART III. --- FINAL STATISTICS
MODEL
LAMBDA
#p
CHI2
p-VALUES
LAMTEST
CHI2TEST
UNSTRUCT
-413.2
o
42
BANDED
-388.1
19.54
22
.10+
.10+
P-P AR(1)
-382.7
24.37
18
.10+
.10+
SIM AR(1)
-377.5
32.54
16
.05+
.01+
S-P MODEL
-374.8
27.13
16
.01+ *
.10+
OLS MODEL
-190.7
220.8
14
**
**
*
In the above tables
LAMBDA
= -2*log(likelihood)
CHI2
= Chi-square
#p
= the
LAMTEST
= p-value
CHI2TEST
= p-value
statistic using the corresponding
covariance matrix
number of parameters in the model
for the test using LAMBDA: e.g. to
test P-P AR(1) against BANDED we take
-382.7 - (-388.1), which has an approximate
Chi-square distribution with 22 - 18 = 4
degrees of freedom.
for the test using CHI2 : e.g. to
test P-P AR(1) against BANDED we take
24.3663 - 19.5432, which also has an
approximate Chi-square distribution with 4
degrees of freedom.
From the above tables, using 5 percent as the level of significance:
in PART I
we accept all models except the split-plot and
OLS models,
in PART II --
we accept the unstructured, banded, and P-P AR(1)
models, and
in PART III
we accept the unstructured, banded, and P-P AR(1)
models.
Page 48
Thus we conclude that the PANTULA-POLLOCK AR(1) MODEL is an appropriate
parsimonious covariance model for these data.
The values of the test
statistics for the linear hypotheses involving parameters of the mean model
under the various covariance structures were:
Effect Tested
d.f.
Values of Test Statistic Under Model:
2
1
Times
Treatments
Times x Treats
3
2
6
1071.7
2.69
7.77
4a
3
708.2 704.1
3.23
3.08
9.54 11.87
4b
5
546.0 1693.7 199.8
3.44
3.03 13.13
8.22 13.45
2.26
Under the P-P AR(1) model, the main effect of times was significant and the
interaction between times and treatments was very nearly significant at the 5
percent level.
b. Simulated Data for a P-P AR(1) Model Without a Covariable
The simulation data set has 30 experimental units divided into 10 blocks
where each block has three treatments, and each unit is measured at 5 different
time points.
The mean model includes a general mean, a cUbic polynomial (3
parameters) for the time points, treatment main effect (2 parameters), and the
treatment x time interaction (3 x 2
=6
parameters).
The true values of the parameters for the simulated data are as follows:
~
and
= (0,1.3,0,0,5,8,0,0,0,0,0,0)'
v.1
NID(O, E 2 )
with
aV
Til
NIO(O,
a~)
with
aT
&ik
NAR( 1) (a 2 ,
s
e ilk
NAR( 1)(ae'
V
2
2'
= 4·'
2
= 3.5;
2
CX
s
)
with
as
= 2.3
CX
CX
e)
with
2
ae
= 1.6
cx e = 0.6.
s
= -0.4;
Page 49
The IML code for specifying the analysis, setting up the design matrix,
and generating the simulated data is:
A=10:
B=3;
C=5:
P=12:
PC=4;
PD=8;
MAXIT=15;
N=A*B:
T=C:
PT=P-PC-PD;
.
TEST=O;
SEEDV=320805:
SEEDD=410265:
SEEDG=92880;
BETA={O,1.3,O,O,5,8,O,O,O,O,O,O}:
*--- {U,L,Q,C,T1,T2,LXTI,QXTI,CXTI} ---;
SV=SQRT(4);
SD=SQRT(2.3):
ALD=-0.4;
SG=SQRT(3.5): SEP=SQRT(1.6):
ALEP=0.6:
SEEDEP=26781:
*--- SET UP GA MATRIX---:
NT=N*T:
GA=J(NT,P,O):
VEC=1:T:
PP=ORPOL(VEC,T):
DO 1=1 TO NT;
GA(II,11)=1:
JJ=MOD( I, T);
IF JJ=O THEN JJ=T:
GA(II,21 )=PP(IJJ,21):
GA ( I I , 3 I ) =PP ( I J J , 3 I ) :
GA( 11,41 )=PP( IJJ,41):
11=INT((1-1)jT)+1:
JJ=MOD( II ,B):
IF JJ=1 THEN DO: GA( 11,51 )=1; GA(II,61 )=0:
IF JJ=2 THEN DO: GA( 11,51 )=O:GA( 11,61 )=1;
IF JJ=O THEN DO: GA(II,51 )=-1;GA( 11,61 )=-1;
DO II=1 TO 3:
DO JJ=1 TO B-1:
KK=(II-1)*(B-1)+JJ+6:
GA( II,KKI)=GA(II,II+1 I )*GA(II,JJ+41);
END:
END:
END;
FREE VEC PP:
END:
END:
END:
Page 50
*--- SET UP THE SIMULATION DATA SET--YA ---;
*--- Y(I,l,K)=MEAN + V(I) + (DElTA(I,K)+EPSIlON.AVE(I,K»
+ GAMMA(I,l) + (EPSIlON(I,l,K)-EPSIlON.AVE(I,K)
YA=GA*BETA;
STORE BETA;
*--- V(I) ERROR TERM
E=J(NT,1);
DO 1=1 TO A;
ER=SV*RANNOR(SEEDV);
DO II=1 TO B*C;
K=(I-1)*B*C + II;
E( I K, 1 I ) =ER ;
END;
END;
YA=YA + E;
*--- DElTA(I,K)* ERROR TERM ---;
DO 1=1 TO A;
DO K=1 TO C;
IF K=1 THEN ER=SD*RANNOR(SEEDD);
ELSE ER=ALD*ER + SD*SQRT(1-ALD**2)*RANNOR(SEEDD);
DO L=1 TO B;
II=(I-1)*B*C + (L-1)*C + K;
E( I II , 1 I ) =ER ;
END;
END;
END;
YA=YA+E;
*--- GAMMA(I,L) ERROR TERM ---;
DO 1=1 TO A;
DO L=1 TO B;
ER=SG*RANNOR(SEEDG);
DO K=1 TO C;
II=(I-1)*S*C + (l-1)*C + K;
E( I II , 1 I ) =ER ;
END;
END;
END;
YA=YA+E;
*--- EPSILON(I,L,K) ERROR TERM ---;
---;
Page 51
DO 1=1 TO A;
DO L=1 TO B;
DO K=1 TO C;
II=(I-1)*B*C + (L-1)*C + K;
IF K=1 THEN E( I II, 1 I ) =SEP*RANNOR (SEEDEP) ;
~
ELSE E(III,11 )=ALEP*E( 111-1,1 I) + SEP*SQRT(1-ALEP**2)*RANNOR(SEEDEP);
END;
END;
END;
*--- THE AVERAGE OVER TREATMENTS OF EPSILON ERROR ---;
EA=J(A*T,1,0);
DO II:1 TO A;
DO JJ=1 TO C;
KK=(II-1)*C + JJ;
DO LL=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
EA(IKK,11 )=EA(IKK,1 1)+E(IMM,1 1 )/B;
END;
END;
END;
*--- EPSILON - EPSILON.AVERAGE ---;
DO II=1 TO A;
DO JJ=1 TO C;
KK=( II-1 )*C+JJ;
00 I:.L=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
E( I MM, 1 I )=E ( I MM ,'1 I ) -EA ( I KK, 1 I ) ;
END;
END;
END;
YA=YA+E;
FREE E EA;
The statistics useful in identifying the proper model are:
1.
MODEL
PART 1.
LAMBDA
CHI2
p-VALUES
#p
LAMTEST
CHI2TEST
UNSTRUCT
196.7
o
BANDED
207.1
9.53
9
.10+
.10+
P-P AR(1)
207.5
11.55
7
.10+
.10+
SIM AR(1)
231.4
24.94
6
**
**
S-P MODEL
219.8
22.10
6
**
**
OLS MODEL
234.5
34.04
5
**
**
19
Page 52
II.
MODEL
PART II.
LAMBDA
CHI2
p-VALUES
#p
LAMTEST
CHI2TEST
UNSTRUCT
307.2
o
23
BANDED
319.9
13.70
13
.10+
.10+
P-P AR(1)
321.7
12.20
11
.10+
.10+
SIM AR(1)
327.4
19.29
10
.01+
*
**
S-P MODEL
324.7
14.87
10
.05+
*
.10+
OLS MODEL
416.6
127.2
9
**
III.
PART III.
MODEL
LAMBDA
CHI2
**
p-VALUES
#p
LAMTEST
CHI2TEST
UNSTRUCT
507.5
o
42
BANDED
530.7
23.23
22
.10+
.10+
P-P AR(1)
532.7
23.75
18
.10+
.95+
SIM AR(1)
562.3
44.23
16
**
**
S-P MODEL
548. 1
36.97
16
**
**
OLS MODEL
654.7
161.2
14
**
**
From the above statistics we conclude for all, three parts that the SIM
AR(1), S-P, and OLS models should be rejected and thus the P-P AR(1) model is
appropriate for these data.
This is as it should be.
Page 53
The estimates of the covariance structure parameters and their approximate
standard errors are as follows:
COMPONENT
ESTIMATE
TRUE VALUE
ST.ERROR
------2-----------------------------------------------ov
4.0000
2.2075
1.7322
-------------------------------------------------------
0;
2.3000
2.8879
0.7639
«s
-0.40000
-0.5884
0.1306
0.6000
0.2894
0.1689
------2-----------------------------------------------aT
3.5000
4.0141
1.4326
------2-----------------------------------------------oe
1.6000
1.4954
0.3473
The differences between the true values and their corresponding estimates
are usually less than 1 and always less than 2 standard errors of the
estimators.
The estimates and their standard errors for the mean model
~,
using the P-
P AR(1) covariance structure, are:
TRUE
o.
1.3
o.
o.
5.
8.
o.
o.
O.
O.
O.
O.
~
ESTIMATE
0.8679
0.9039
0.4939
-0.4832
5.8339
7.7966
0.2077
-0.0386
0.2440
0.0499
-0.3051
0.0230
ST. ERROR
0.6113
0.3901
0.4229
0.5392
0.4466
0.4466
0.2812
0.2812
0.2444
0.2444
0.2187
0.2187
Again all the estimates are within 1 or 2 standard errors of the true
values.
Page 54
c. Simulated Oata for a P-P AR(1) Model With a Covariable
The simulated data with a covariable are similar to the previous
exa~ple.
The data set has thirty experimental units arranged in ten blocks and each
block contains three treatments.
The parameters of the covariance structure
for this data set are the same as the previous example.
model here has one extra factor -a covariable.
However, the mean
The covariable is generated as
a normal random variable with mean 1 and variance 4.
The true
f)
f)
is:
= (0,1.3,0,0,5,8,0,0,0,0,0,0,5) .
The IML statements for generating the G matrix and defining the dimensions
of the problem are:
A=10i
B=3;
C=5;
P=13;
PC=4;
PO=8i
MAXIT=15 ;
N=A*B;
T=C;
PT=P-PC-PO;
TEST=O;
SEEOV=320805; SEEOD=410265; SEEOG=92880i SEEOEP=26781; SEEOCV=7801i
BETA={0,1.3,0,0,5,8,0,0,O,0,O,0,5}i
*--- {U,L,Q,C,T1,T2,LXTI,QXTI,CXTI,CV} ---;
SV=SQRT(4);
SO=SQRT(2.3)i
ALO=-O.4;
SG=SQRT(3.5)i SEP=SQRT(1.6);
ALEP=0.6;
SCV=2;
*--- SET UP GA MATRIX---;
NT=N*Ti
GA=J(NT,P,O);
Page 55
VEC=1:T;
PP=ORPOL(VEC,T);
00 1=1 TO NT;
GA ( I I , 1 I )=1;
GA(II,PI )=1 + 2*RANNOR(SEEDCV);
JJ=MOD( I, T);
IF JJ=O THEN JJ=T;
GA(II,21 )=PP( IJJ,21);
GA(II,31)=PP( IJJ,31);
GA(II,41 )=PP(IJJ,41);
II=INT((I-1)/T)+1;
JJ=MOD ( I I, B) ;
IF JJ=1 THEN 00; GA( 11,51 )=1; GA(II,61 )=0;
IF JJ=2 THEN 00; GA(II,51 )=O;GA( 11,61 )=1;
IF JJ=O THEN 00; GA( 11,51 )=-1;GA( 11,61 )=-1;
00 II=1 TO 3;
00 JJ=1 TO B-1;
KK=(II-1)*(B-1)+JJ+6;
GA(II,KKI )=GA( II,II+11)*GA( II,JJ+41);
END;
END;
END;
FREE VEC PP;
END;
END;
END;
The Yth observation vector was generated the same way as in the previous
example
excep~
for the addition of 5*Zilk where Zilk is NID(1,4).
The statistics from the output useful in identifying the appropriate
covariance structure are:
1. PART 1.
MODEL
LAMBDA
CHI2
p-VALUES
#p
LAMTEST
CHI2TEST
.10+
.05+ *
UNSTRUCT
194.4
o
20
BANDED
209.1
17.00
10
P-P AR(1)
217.9
28.69
8
SIM AR(1)
232.9
31.45
7
**
.10+
S-P MODEL
220.5
29.58
7
.10+
.10+
OLS MODEL
242.8
47.30
6
**
**
.01+ *
**
Page 56
II. PART II.
MODEL
LAMBDA
CHI2
p-VALUES
#p
LAMTEST
CHI2TEST
UNSTRUCT
300.8
o
24
BANDED
308.4
9.84
14
.10+
.10+
P-P AR(1)
309.6
11.45
12
.10+
.10+
SIM AR(1)
312.1
13.36
11
.10+
.10+
S-P MOOEL
316.5
18.22
11
**
**
OLS MOOEL
384.3
105.2
10
**
**
CHI2
#p
III.PART III.
MODEL
LAMBDA
p-VALUES
LAMTEST
UNSTRUCT
498.8
o
43
BANDED
521.1
26.84
23
.10+
P-P AR( 1)
531.1
40.15
19
.025+
SIM AR(1)
548.6
44.81
17
**
S-P MOOEl
540.5
47.80
17
.01-
OLS MODEL
630.7
152.5
15
**
CHI2TEST
.10+
*
*
.01
*
.05+
*
.01+
*
**
Even though these data were generated using the P-P AR(1) structure, we
reject this structure in Parts I and III.
reject the BANDED model in PART I.
models.
Using the CHI2 statistic we even
In PART II, we reject only the S-P and OLS
We would probably choose the BANDED model as the best parsimonious
model for these data.
Page 57
The estimates of the covariance parameters from the P-P AR(1) model are:
COMPONENT
TRUE VALUE
ESTIMATE
ST. ERROR
------2------------------------------------------------0v
4.0000
3.8294
2.2710
------2------------------------------------------------Os
2.3000
2.9249
0.6554
as
-0.4000
-0.2549
0.1850
0.6000
0.4445
0.1742
------2------------------------------------------------O~
3.5000
2.3972
1.0460
------2------------------------------------------------0e
1.6000
1.7497
0.5307
Except for O~' all true values are within 1 standard error of the
corresponding estimates, and O~ is within 2 standard errors of the estimate.
The final estimates for the components of
TRUE
O.
1.3
O.
O.
5.
8.
O.
O.
O.
O.
O.
O.
5.
~
~
ESTIMATE
ST. ERROR
-0.2992
1.7370
-0.3127
0.4487
5.2239
7.7385
-0.0510
0.0790
0.0662
-0.0593
0.0916
0.4025
4.8885
0.7105
0.4823
0.5205
0.5769
0.4553
0.4553
0.3821
0.3884
0.2989
0.3024
0.2531
0.2591
0.0690
from PART III are as follows:
Except for the last two components which lie within 2 standard errors of
their estimates, all components are within 1 standard error of their estimates.
Page 58
7.
References
Fuller, W. A. (1987).
Measurement Error Models. New York: Wiley.
Hoffman, D. J., Franson, J. C., Pattee, O. H., Bunck, C. M. and
Anderson, A. (1985). Survival, growth, and accumulation of
ingested lead in nestling American Kestrels (Falco sparverius).
Arch Environ Contam Toxicol 14:89-94.
Jennrich, R. I. and Schluchter, M. D. (1986). Unbalanced repeatedmeasures models with structured covariance matrices. Biometrics
42:805-820.
Pantula, S. G. and Pollock, K. H. (1985). Nested analysis of variance
with autocorrelated errors. Biometrics 41:909-920.
Pantula, S. G. and Pollock, K. H. (1986). Split-block models with
time series components for repeated measurements. North Carolina
State University Technical Report.
Schaalje, G. B., Zhang, J., Pantula, S. G. and Pollock, K. H. (1987).
REMAC: Repeated measures analysis for complete data. North
Carolina State University. Institue of Statistics Mimeo Series
No. 1911.
Page 59
8.
*---
Program Code
LEAD DATA - 3 TRTS - 5 TIMES - LOG TRANSFORM ---;
DATA LEAD;
INPUT BLOCK TRT $ W1-W5;
DROP W1-W5;
ARRAY W(I) W1-W5;
DO 1=1 TO 5;
WGT=LOG(W);WEEK=I;
IF TRT NE '3' THEN OUTPUT;
END;
*---
INPUT THE LEAD DATA SET ---;
CARDS;
506 C 12
506 1 13
506 2 13
506 3 11
254 C 16
254 1 13
254 2 15
254 3 16
504 C 10
504 1 11
504 2 11
504 3 11
247 C 12
247 1 12
247 2 10
247 3 10
248 C 11
248 1 12
248 2 14
248 3 11
255 C 10
255 1 8
255 2 9
255 3 11
508 C 13
508 1 14
508 2 14
508 3 13
243 C 13
243 1 13
243 2 11
243 3 16
517 C 16
15
14
15
13
19
15
17
16
14
13
13
13
16
17
11
12
15
18
16
11
14
10
12
14
17
19
18
16
14
13
11
17
20
21
20
20
17
26
21
22
22
19
19
18
18
19
21
15
15
18
21
20
12
17
13
14
16
24
25
24
21
19
18
13
22
24
26
25
24
19
33
26
28
25
25
23
22
21
24
27
19
18
21
26
24
14
22
16
18
20
32
36
32
28
25
23
17
25
31
29
25
25
19
40
34
34
29
32
29
29
25
25
32
21
16
27
31
29
16
29
24
25
27
42
40
35
29
31
30
22
30
40
35
29
30
15
49
44
40
32
44
37
37
32
41
46
30
18
37
45
39
16
38
35
32
32
49
50
45
34
37
35
24
36
46
56
44
37
•
63
54
50
34
52
41
41
37
46
52
34
20
41
51
39
.
47
38
38
37
57
62
50
36
43
42
29
39
51
62 76 81
48 62 65
43 52 55
72
61
58
36
68
56
53
41
65
69
44
25
49
66
51
86
76
74
38
77
61
62
42
69
71
47
26
61
74
60
90
86
82
43
82
68 .
66
43
75
80
54
30
64
77
62
62
52
51
48
71
74
62
39
56
52
40
53
63
69
60
59
52
75
79
69
44
68
66
48
65
70
75
62
63
51
89
98
84
52
73
72
59
72
76
Page 60
517
517
517
264
264
264
264
1
2
3
C
1
2
3
16
12
19
16
12
17
15
21
17
21
22
17
20
23
26
22
26
25
20
28
24
30
28
30
35
25
34
32
39
34
33
40
29
36
36
47
39
30
51
36
46
44
52
41
28
62
50
55
45
63
50
.
69
62
59
46
69 74
50 61
85 90
71 71
77 82
.
PROC SORT DATA=LEADi
BY BLOCK TRT WEEKi
*---
DATA SET TWO HAS 3 TRT'S 5 TIMES
---i
DATA TWOi
SET LEADi
KEEP WGT WEEKi
PROC IMLi
START REMACRBi
*---
EGLS REPEATED MEASURES ANALYSIS FOR COMPLETE DATA IN RANDOM
BLOCKS - - - i
*--*--*--*--*--*--*---
DEFINE PARAMETERS OF THE PROBLEM
*--*--*--*--*--*--*--*---
*---
*---
---i
A = NUMBER OF BLOCKS - - - i
B = NUMBER OF TREATMENTS - - - i
C = NUMBER OF TIME POINTS = T - - - i
P = NUMBER OF PARAMETERS IN THE MODEL FOR THE MEANS - - - i
PC = NUMBER OF PARAMETERS WHICH DO NOT INVOLVE TREATMENTS
PO ~ NUMBER OF PARAMETERS WHICH DO NOT INVOLVE BLOCKS BUT
INVOLVE TREATMENTS AND/OR TREATMENT BY TIME INTERACTIONS ---i
Y = DATA VECTOR ARRANGED SUCH THAT ALL OBSERVATIONS FOR A
SINGLE INDIVIDUAL ARE CONSECUTIVE AND IN THE PROPER ORDER - - - i
GA = DESIGN MATRIX WHICH MUST BE SET UP ENTIRELY BY THE USER
AND MUST BE OF FULL RANK ---i
MAXIT = NUMBER OF ITERATIONS DESIRED FOR ITERATIVE ESTIMATES
AND WE SUGGEST THAT IT BE <= 16 - - - i
N = NUMBER OF INDIVIDUALS - - - i
T = NUMBER OF TIME PERIODS FOR EACH INDIVIDUAL - - - i
PT = NUMBER OF PARAMETERS WHICH INVOLVE BLOCKS TREATMENTS
AND TIME POINTS - - - i
TEST = VARIABLE INDECATING HOW MANY LINEAR HYPOTHESES AE TO BE
TESTED. MUST BE SET TO ZERO IF NONE - - - i
H,DL = MATRICES DEFINING THE LINEAR HYPOTHESES TO BE TESTED. IF
WE WISH TO TEST THE HYPOTHESES
H: H1'B=DL1
AND
H: H2'B=OL2,
THEN H=H1//H2 AND DL=DL1//DL2 ---i
R = COLUMN VECTOR GIVING THE DEGREES OF FREEDOM FOR EACH OF THE
HYPOTHESIS TESTS. SET TO 1 IF NONE - - - i
SIZE OF H:
ROWSIZE=SUM OF R, COLSIZE=P,
SIZE OF DL: ROWSIZE=SUM OF R, COLSIZE=l. - - - i
Page 61
A=10;
B=3;
C=5;
P=12;
PC=4;
PD=8;
MAXIT=15;
TEST=3;
R={3,2,6};
H={O 1 0 0 0 0 0 0 0 0 0 0,
o 0 1 0 0 0 0 0 0 0 0 0,
o 0 0 1 0 0 0 0 0 0 0 0,
o 0 0 0 1 0 0 0 0 0 0 0,
o 0 0 0 0 1 0 0 0 0 0 O};
o 0 0 0 0 0 1 0 0 0 0 O};
o 0 0 0 0 0 0 1 0 0 0 O};
o 0 0 0 0 0 0 0 1 0 0 O};
o 0 0 0 0 0 0 0 0 1 0 O};
o 0 0 0 0 0 0 0 0 0 1 O};
o 000 0 0 0 0 0 0 0 1};
DL={O,O,O,o,o,o,o,o,O,O,O}; STORE H DL R;
*--- READ IN DATA VALUES AND SET UP YA ---;
N=A*B;
T=C;
PT=P-PC-PD;
NT=N*T;
YA=J(NT,2);
USE TWO;
READ ALL INTO VA;
YA=YA(I,11);
*--- SeT UP GA MATRIX---;
GA=J(NT,P,O);
VEC=1:T;
PP=ORPOL(VEC,T);
DO 1=1 TO NT;
GA(II,11)=1;
JJ=MOD( I, T);
IF JJ=O THEN JJ=T;
GA( I 1,21 )=PP ( I JJ, 21 ) ;
GA(II,31 )=PP( IJJ,31);
GA(II,41)=PP(IJJ,41 );
11=INT((1-1)/T)+1;
JJ=MOD ( II , B) ;
IF JJ=1 THEN DO; GA(II,51 }=2; GA(II,61 )=0;
IF JJ=2 THEN DO; GA( 11,51}=-1;GA(II,61)=1;
END;
END;
Page 62
IF JJ=O THEN DO; GA(II,51 )=-1;GA( 11,61 )=-1;
DO II=1 TO 3;
DO JJ=1 TO B-1;
KK=(II-1)*(B-1)+JJ+6;
GA ( I I, KK I ) =GA( I I, II +1 I )*GA ( I I, JJ+41 ) ;
END;
END;
END;
FREE VEC PP;
END;
PP=1;
PARTI :
IF PP=1 THEN DO;
*--- COMPUTATIONS FOR BLOCK MEANS ---;
N=A;
P=PC+PT;
NT=N*T;
*--- SET UP Y -
BLOCK MEANS OVER TIME ---;
Y=J(NT,1 ,0);
DO II=1 TO A;
DO JJ=1 TO C;
KK=(II-1 )*C+JJ;
DO LL=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
Y( IKK,1 I )=Y(IKK,11)+YA(IMM,1 1)/B;
END;
END;
END;
*--- SET UP G MATRIX
-
BLOCK MEANS OVER TIME ---;
G=J(NT,P,O);
DO CL=1 TO P;
DO II=1 TO A;
DO JJ=1 TO C;
KK=(II-1 )*C+JJ;
DO LL=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
IF CL > PC THEN CLL=CL+PD;
ELSE CLL=CL;
G(IKK,CLI )=G(IKK,CLI)+GA( IMM,CLLI )/B;
END;
END;
END;
END;
Page 63
STORE YA GA;
END;
PARTII:
IF PP=2 THEN DO; LOAD YA GA; YD=YA; GD=GA; STORE VA GA;
*--- COMPUTATIONS AFTER SUBTRACTING THE BLOCK MEANS ---;
N=A*B;
P=PD+PT;
NT=N*T;
*--- SET UP V -
DEVIATION FROM BLOCK MEANS OVER TIME ---;
DO 11=1 TO A;
DO JJ=1 TO C;
KK=( 11-1 )*C+JJ;
DO LL=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
VD(IMM,11 )=YD(IMM,11)-V(IKK,1
END;
END;
END;
*--- SET UP G MATRIX
-
I);
DEVIATION FROM BLOCK MEANS OVER TIME ---;
G=J(A*T,P,O);
DO CL=1 TO P;
DO 11=1 TO A;
DO JJ=1 TO C;
KK=( 11-1 )*C+JJ;
DO LL=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
G( IKK,CLI)=G( IKK,CLI)+GD( IMM,CL+PCI )/B;
END;
END;
END;
END;
GD=GD(I,PC+1:PC+PD+PTI );
DO CL=1 TO P;
DO II=1 TO A;
DO JJ=1 TO C;
KK=( II-1 )*C+JJ;
DO LL=1 TO B;
MM=(II-1)*B*C+(LL-1)*C+JJ;
GD(IMM,CLI )=GD( IMM,CLI )-G( IKK,CLI);
END;
END;
END;
END;
Page 64
Y=YD;
G=GD;
FREE YO GO;
END;
IF PP=1 THEN 00; NT1=NT;
IF PP=2 THEN 00; NT1=NT-(A*T);
N1=N;
N1=N-A;
END;
END;
*---COMPUTATION FOR PSI AND PHI MATRICES AND CONST
CONST=NT1*LOG(4*ARSIN(1»;
T1=T*(T+1 )/2;
PSI=J(T1, T*T ,0);
PHI=PSI';
CR=-T-1;
00 JP=1 TO T;
CR=CR+T-JP+2;
00 IP=JP TO T;
00 KP=1 TO T;
DO SP=1 TO T;
CP=CR+IP-JP+1;
RP=(SP-1)#T+KP;
PSI(ICP,RPI )=«1#(KP=JP»*(1#(SP=IP»+(1#(KP=IP»*(1#(SP=JP»)/2;
PHI( IRP,CPI )=(2-(1#(KP=SP»)#PSI( ICP,RPI);
END;END;END;END;
*--- CREATE EGLS SUBROUTINE ---;
START EGLS(BETA,SEB,RSS,LAM,CHI1,CHI2,SEBO,RM,SIGMA,IVI,IV,A,N,T,P,
Y,G,PSI,SHAT1ST,PP);
NT=N*T;
IF PP=1 THEN 00; NT1=NT;
IF PP=2 THEN DO; NT1=NT-(A*T);
CONST=NT1*LOG(4*ARSIN(1»;
IS=INV(SIGMA) ;
LSO=J(P,P,O);
LS1=LSO;
LS2=J(P,1,0);
DO K = 1 TO (N-1)*T+1 BY T;
KP = K+T-1;
GP=G(IK:KP,1:PI );
LSO=LSO+GP'*SIGMA*GP;
LS1=LS1+GP'*IS*GP;
LS2=LS2+GP'*IS*Y(IK:KP,1 I);
END;
N1=N;
N1=N-A;
END;
END;
Page 65
CB=GINV(LS1);
BETA=CB*LS2;
SEB=SQRT(VECDIAG(CB));
GG=INV( G'*G) ;
SEBO=SQRT(VECDIAG(GG*LSO*GG));
RES=Y-G*BETA;
RM=SHAPE(RES,N,T);
RSS=O;
00 K = 1 TO N;
RSS=RSS+RM(IK,I)*IS*RM( IK, I )';
END;
D=DET(SIGMA) ;
LAM=Nl*LOG(D)+RSS+CONST;
E=SHAT1ST-PSI*SHAPE(SIGMA,T*T,1);
CHll=E'*IV*E;
CHI2=E'*IVI*E;
FREE LSO LSl LS2 GP CB E RES GG;
FINISH;
IF PP=l THEN 00;
PRINT 'MODEL-l == UNSTRUCTURED MODEL';
PRINT 'MODEL-2 == BANDED MODEL';
PRINT 'MODEL-3 == PANTULA-POLLOCK AR(l) MODEL';
PRINT 'MODEL-4A == SIMPLE AR(l) MODEL';
PRINT 'MODEL-4B == SPLIT-PLOT MODEL';
PRINT 'MODEL-5 == ORDINARY LEAST SQUARES MODEL';
PRINT'
';
END;
*--- MODEL-5 == ORDINARY LEAST SQUARES MODEL ---;
GG=INV(G'*G) ;
BETA5=GG*G'*y;
RES=Y-G*BETAS;
RESS=RES'*RES;
SES=RESS/NTl ;
THS=SE5;
NPARA5=P+l;
SETHS=SES/NT1*SQRT(2*(NT1-P));
RSSS=NTl ;
SHAT5=SES*I(T); IS=l/SES*I(T);
IV5=Nl/2*PHI'*(IS@IS)*PHI; FREE IS;
SEB5=SQRT(VECDIAG(GG*SE5));
SEB05=SEB5;
IS=SHAPE(RES,N,T);
SHATO=IS'*IS/Nl;
FREE IS GG;
Page 66
*--- MODEL-1 == UNSTRUCTURED COVARIANCE MATRIX MODEL ---;
IVI=J(T1,T1,0);
IV=J(T1,T1,0);
SHAT1ST=J(T1,1,0);
RUN EGLS(BETA1,SEB1,RSS1,LAM1,CHI11,CHI21,SEB01,RM,SHATO,IVI,IV,A,N,T,P,
Y,G,PSI,SHAT1ST,PP)j
SHAT1=RM'*RM/N1;
IS=INV(SHAT1);
FREE RM;
IV=Nl/2*PHI'*(IS@IS)*PHI;
FREE IS;
SHAT1ST=PSI*SHAPE(SHAT1,T*T,1);
NPARA1=T1 +P;
TH1=PSI*SHAPE(SHATO,T*T,1);
CB=2/N*PSI*(SHATO@SHATO)*PSI';
FREE SHATO;
SETH1=SQRT(VECDIAG(CB));
FREE CB;
*--- STATISTICS FOR MODEL-S ---;
LAMS=NT1*LOG(SES)+RSSS+CONST;
E=SHAT1ST-PSI*SHAPE(SHATS,T*T,1);
CHI1S=E'*IV*E;
CHI2S=E'*IVS*E;
FREE E IVS;
*---MODEL-2 == THE BANDED MODEL ---;
F=J(T*T,T,O);
00 K = 1 TO T;
DO L = 1 TO T;
M=(L-1)*T+K;
AD=ABS(K-L)+l;
F( IM,ADI )=1;
END;
END;
F=PSI*F;
SHAT2=J(T,T);
00 M = 1 TO MAXIT;
IF M=l THEN IVI=IV;
ELSE DO;
IS=INV(SHAT2);
IVI=Nl/2*PHI'*(IS@IS)*PHI;
CB=INV(F'*IVI*F);
TH2=CB*F'*IVI*SHAT1ST;
IF TH2(11,11)<0 THEN TH2(11,11 )=0;
DO K = 1 TO T;
DO L = 0 TO T-K;
SHAT2( IK,K+LI )=TH2(IL+l,11);
SHAT2 ( I K+L, KI ) =TH2 ( I L+1 ,11 ) ;
END;
END;
END;
SETH2=SQRT(VECDIAG(CB));
NPARA2=T+P;
FREE CB IS;
END;
Page 67
RUN EGLS(BETA2,SEB2,RSS2,LAM2,CHI12,CHI22,SEB02,RM,SHAT2,IVI,IV,A,
N,T,P,Y,G,PSI,SHAT1ST,PP);
FREE RM F RES;
*--- COMPUTATIONS FOR ALPHA ---;
MW14A=TH2(11,1 I); MW24A=TH2(12,11);
MW13= TH2 ( 11 , 1 1)- TH2 ( 12,1 I ); MW23= TH2 ( /2,1 I )- TH2 ( 13, 1 1) ;
AL4A=MW24A/MW14A; AL3=MW23/MW13;
IF AL4A > 0.995 THEN AL4A=0.995;
IF AL4A < -0.995 THEN AL4A=-0.995;
IF AL3 > 0.995 THEN AL3=0.995;
IF AL3 < -0.995 THEN AL3=-O.995;
*--- COMPUTATIONS FOR THE VARIANCE COMPONENTS FOR MODEL-3 AND 4A
SE3=MW13*(1+AL3);
SV3=MW14A-SE3/(1-AL3**2);
SE4A=MW14A*(1-AL4A**2);
FREE MW13 MW23 MW14A MW24A;
*--- MODEL-3 == PANTULA-POLLOCK AR(1) MODEL·---;
SN3=SE3/(1-AL3**2);
SHAT3=J(T,T);
DO II = 1 TO T;
DO JJ = 1 TO T;
SHAT3( III,JJI )=SN3*(AL3**ABS(II-JJ))+SV3;
END;
END;
DO M = 1 TO MAXIT;
F=J(T*T,3,1);
DO JJ=1 TO T;
DO II=1 TO T;
K=( II-1 )*T+JJ;
AD=ABS(II-JJ);
F( IK,21 )=AL3**AD;
F(IK,31 )=AD*SN3*AL3**(AD-1);
END;END;
E=SHAT1ST-PSI*SHAPE(SHAT3,T*T,1);
F=PSI*F;
IS=INV(SHAT3);
IVI=N1/2*PHI'*(IS@IS)*PHI;
CB=INV(F'*IVI*F);
Page 68
DEL=CB*F'*IVI*E;
SV3=SV3+DEL(ll,1 I);IF SV3 < 0 THEN SV3=0;
AL3=AL3+DEL(13,1 I );IF ABS(AL3) >= 1 THEN DO;
IF AL3 < 0 THEN AL3=-.995;ELSE AL3=.995;END;
SN3=SN3+DEL(12,l I );IF SN3 < 0 THEN SN3=SE3/(1-AL3**2);
DO II=l TO T;
DO JJ=l TO T;
SHAT3( III,JJI)=SV3+SN3*AL3**ABS(II-JJ);
END;END;
END;
FREE F E IS DEL;
TH3=J(3,1,SV3);
TH3 ( I 2, 1 I ) =SN3 ;
TH3 ( 13, 1 I ) =AL3;
SETH3=SQRT(VECDIAG(CB));
NPARA3=P+3;
FREE CB SV3 AL3 SN3;
RUN EGLS(BETA3,SEB3,RSS3,LAM3,CHI13,CHI23,SEB03,RM,SHAT3,IVI,IV,A,
N,T,P,Y,G,PSI,SHAT1ST,PP);
FREE RM;
*--- MODEL-4A == SIMPLE AR(l) MODEL ---;
SN4A=SE4A/(1-AL4A**2);
SHAT4A=J(T,T);
DO II = 1 TO T;
DO JJ = 1 TO T;
SHAT4A(III,JJI )=SN4A*(AL4A**ABS(II-JJ));
END;
END;
DO M = 1 TO MAXIT;
F=J(T*T,2,0);
DO II = 1 TO T;
DO JJ = 1 TO T;
K=(J J -1 )*T +II ;
AD=ABS( II-JJ);
F( IK,ll )=AL4A**AD;
IF AD=O THEN F( IK,21 )=0;
LSE
F(IK,21 )=AD*SN4A*AL4A**(AD-l);
END;
END;
E=SHAT1ST-PSI*SHAPE(SHAT4A,T*T,1);
F=PSI*F;
IS=INV(SHAT4A) ;
IVI=Nl/2*PHI'*(IS@IS)*PHI;
CB=INV(F'*IVI*F);
DEL=CB*F'*IVI*E;
AL4A=AL4A+DEL(12,1 I);
Page 69
IF ABS(AL4A) >= 1 THEN DO;
IF AL4A < 0 THEN AL4A=-.995;
ELSE AL4A=.995;
SN4A=SN4A+OEL(ll,11 );
IF SN4A < 0 THEN SN4A=SE4A/(1-AL4A**2);
END;
00 II = 1 TO T;
DO JJ = 1 TO T;
SHAT4A( III,JJI )=SN4A*(AL4A**ABS(II-JJ»;
END;
END;
END;
FREE F E DEL IS;
TH4A=J(2,1,SN4A);
TH4A(12,11 )=AL4A;
SETH4A=SQRT(VECDIAG(CB»;
NPARA4A=P+2;
FREE CB AL4A SN4A SE4A;
RUN EGLS(BETA4A,SEB4A,RSS4A,LAM4A,CHI14A,CHI24A,SEB04A,RM,SHAT4A,
IVI,IV,A,N,T,P,Y,G,PSI,SHAT1ST,PP);
FREE RM;
*--- MODEL-4B == SPLIT-PLOT MODEL
F=J(T*T,2,1);
DO II = 1 TO T;
DO JJ = 1 TO T;
K=(JJ-1 )*T+II;
AD=ABS( II-JJ) ;
IF AO=O THEN
F(IK,21)=1;
ELSE
F ( I K, 2 I ) =0 ;
END;
END;
F=PSI*F;
SHAT4B=J(T,T);
DO M = 1 TO MAXIT;
IF M=l THEN IVI=IV:
ELSE DO;
IS=INV(SHAT4B);
IVI=N1/2*PHI'*(IS@IS)*PHI;
END;
CB=INV(F'*IVI*F);
TH4B=CB*F'*IVI*SHAT1ST;
IF TH4B( 11,1 I )<0 THEN TH4B( 11,11 )=0;
SHAT4B=TH4B(12,11 )*I(T)+J(T,T,TH4B( 11,11»;
END;
SETH4B=SQRT(VECDIAG(CB»;
FREE CB IS F:
NPARA4B=P+2;
Page 70
RUN EGLS(BETA4B,SEB4B,RSS4B,LAM4B,CHI14B,CHI24B,SEB04B,RM,SHAT4B,
IVI,IV,A,N,T,P,Y,G,PSI,SHAT1ST,PP);
FREE RM;
*--- END OF ALL COMPUTATIONS ---;
PRINT I;
IF PP=1 THEN DO;
*--- PRINTOUTS OF FINAL RESULTS ---;
PRINT'
,;
PRINT 'THE RESULTS FOR PART I -- BLOCK MEANS OVER TIME'; END;
IF PP=2 THEN DO;
PRINT
'THE RESULTS FOR PART II
OVER TIME';
END;
--
DEVIATIONS FROM THE BLOCK MEANS
START PRINTOUT(T1,RSS,NPARA,BETA,SEB,TH,SETH,SHAT,LAM,CHI1,CHI2);
B1={" "};
BLK=REPEAT(B1,1,T1*T1);
PRINT 'THE RESIDUAL SUM OF SQUARES';
PRINT RSS (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE NUMBER OF PARAMETERS IN THIS MODEL';
PRINT NPARA (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE ESTIMATES OF THE PARAMETERS FOR THE MEAN OF THE MODEL';
BETA=BETA' ;
PRINT BETA (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE STANDARD ERRORS FOR THE ABOVE ESTIMATES'; SEB=SEB'i
PRINT SEB (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE ESTIMATES OF THE PARAMETERS FOR THE COVARIANCE MATRIX'i
TH=TH' ;
PRINT TH (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE STANDARD ERRORS FOR THE ABOVE ESTIMATES'; SETH=SETH';
PRINT SETH (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE ESTIMATED COVARIANCE MATRIX';
PRINT SHAT (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE MINUS TWO LAMBDA STATISTIC' ;
PRINT LAM (IROWNAME=BLK COLNAME=BLKI);
PRINT 'THE CHISQUARE STATISTICS';
PRINT CHI1 (IROWNAME=BLK COLNAME=BLKI)
CHI2 (IROWNAME=BLK COLNAME=BLKI);
FINISH;
PRINT I;
PRINT 'THE RESULTS FOR MODEL-1 == UNSTRUCTURED MODEL';
RUN PRINTOUT(T1,RSS1,NPARA1,BETA1,SEB1,TH1,SETH~,SHAT1,LAM1,CHI11,
CHI21);
FREE BETA1 SEB1 TH1 SETH1;
Page 71
PRINT Ii
PRINT 'THE RESULTS FOR MODEL-2 == BANDED MODEL';
RUN PRINTOUT(T1,RSS2,NPARA2,BETA2,SEB2,TH2,SETH2,SHAT2,LAM2,CHI12,
CHI22);
FREE BETA2 SEB2 TH2 SETH2;
PRINT /;
PRINT 'THE RESULTS FOR MODEL-3 == PANTULA-POLLOCK AR(1) MODEL';
RUN PRINTOUT(T1,RSS3,NPARA3,BETA3,SEB3,TH3,SETH3,SHAT3,LAM3,CHI13,
CHI23);
FREE BETA3 SEB3 ;
IF PP=1 THEN DO;
THA=TH3'; SETHA=SETH3';
FREE TH3 SETH3;
STORE THA SETHA;
END;
PRINT Ii
PRINT 'THE RESULTS FOR MODEL-4A == SIMPLE AR(1) MODEL';
RUN PRINTOUT(T1,RSS4A,NPARA4A,BETA4A,SEB4A,TH4A,SETH4A,SHAT4A,LAM4A,
CHI14A,CHI24A);
FREE SEB4A TH4A SETH4A BETA4A;
PRINT I;
PRINT 'THE RESULTS FOR MODEL-4B == SPLIT-PLOT MODEL';
RUN PRINTOUT(T1,RSS4B,NPARA4B,BETA4B,SEB4B,TH4B,SETH4B,SHAT4B,LAM4B,
CHI14B,CHI24B);
FREE SEB4B TH4B SETH4B BETA4B;
PRINT I;
PRINT 'THE RESULTS FOR MODEL-S == ORDINARY LEAST SQUARES MODEL';
RUN PRINTOUT(T1,RSSS,NPARAS,BETAS·,SEBS,THS,SETHS,SHAT5,LAM5,CHI15,
CHI2S);
FREE
SEBS TH5 SETHS;
PRINT'
';
PRINT
'THE OLS ESTIMATES FOR THE MEAN OF THE MODEL AND THEIR STANDARD
ERRORS UNDER DIFFERENT COVARIANCE STRUCTURES';
B1={" "};
BLK=REPEAT(B1,1,T1*T1);BETA=BETAS';
FREE BETAS B1;
PRINT BETA (IROWNAME=BLKI) SEB01 (IROWNAME=BLKI)
SEB02 (IROWNAME=BLKI) SEB03 (IROWNAME=BLKI);
PRINT SEB04A (IROWNAME=BLKI) SEB04B (IROWNAME=BLKI)
SEBOS (IROWNAME=BLKI);
FREE BETA SEB01 SEB02 SEB03 SEB04A SEB04B SEBOS;
*--- SECOND ROUND RUNNING ---;
IF PP=1 THEN DO; PP=PP+1;
SHAT1C=SHAT1; LAM1C=LAM1; FREE SHAT1; STORE SHAT1C; FREE SHAT1C;
SHAT2C=SHAT2; LAM2C=LAM2i FREE SHAT2; STORE SHAT2C; FREE SHAT2C;
SHAT3C=SHAT3; LAM3C=LAM3; FREE SHAT3; STORE SHAT3C; FREE SHAT3C;
SHAT4AC=SHAT4A; LAM4AC=LAM4A; FREE SHAT4A; STORE SHAT4AC; FREE SHAT4AC;
SHAT4BC=SHAT4B; LAM4BC=LAM4B; FREE SHAT4B; STORE SHAT4BC; FREE SHAT4BC;
SHATSC=SHATS; LAMSC=LAMS; FREE SHATS; STORE SHAT5C; FREE SHAT5C;
PRINT I;
GOTO PARTII;
END;
Page 72
PARTIll :
IF PP=2 THEN DO;
FREE RSS1 NPARA1;
FREE RSS2 NPARA2;
FREE RSS3 NPARA3;
FREE RSS4A NPARA4A;
FREE RSS4B NPARA4B;
FREE RSS5 NPARA5;
STORE SHAT2 SHAT3 SHAT4A SHAT4B SHAT5;
PRINT /;
T=B*C;
T1=T*(T+1 )/2;
PSI=J(T1, T*T ,0);
PHI=PSI';
CR=-T-1;
DO JP=1 .TO T;
CR=CR+T-JP+2;
DO IP=JP TO T;
DO KP=1 TO T;
DO SP=1 TO T;
CP=CR+IP-JP+1;
RP=(SP-1)#T+KP;
PSI( ICP,RPI)=«1#(KP=JP»*(1#(SP=IP»+(1#(KP=IP»*(1#(SP=JP»)/2;
PHI(IRP,CPI )=(2-(1#(KP=SP»)#PSI( ICP,RPI);
END;END;END;END;
*--- STATISTICS FOR MODEL-1
UNSTRUCTURED MODEL ---;
LOAD SHAT1C;
IS=INV(SHAT1*B/(B-1»;
IS=I(B)@IS+J(B,B, 1/B)@(INV(SHAT1C*B)-IS);
IV=A/2*PHI'*(IS@IS)*PHI;
SHAT1B=SHAT1C-SHAT1/(B-1);
FREE SHAT1C;
MEB1=MIN(EIGVAL(SHAT1B»;
SHAT1=I(B)@(SHAT1*B/(B-1»+J(B,B,1)@SHAT1B;
SHAT1ST=PSI*SHAPE(SHAT1,T*T,1);
LOAD YA GA;
P=PC+PD+PT;
STORE SHAT1 B;
GG=INV(GA'*GA); LOAD H DL R;
*--- STATISTICS FOR MODEL-5 ORDINARY LEAST SQUARES MODEL ---;
LOAD SHAT5 SHAT5C;
BO=-1;
RUN STAT(LAM5,CHI15,CHI25,MEB5,SHAT5B,PSI,PHI,A,B,C,SHAT5,SHAT5C,
LAM5C,IV,SHAT1ST,BETA5,SEB5,SEB05,YA,GA,P,PT,HTEST5,H,TEST,R,DL,BO,GG);
FREE SHAT5C LAM5C SHAT5;
STORE SHAT5B;
Page 73
IF PT > 0 THEN DO;
LSO=J(P,P,O);
LS1=LSO;
LS2=J(P,1,O);
DO K=l TO (A-l)*T+l BY T;
KP=K+T-l;
GP=GA(IK:KP,l:PI );
LSO=LSO+GP'*SHAT1*GP;
LS1=LS1+GP'*IS*GP;
LS2=LS2+GP'*IS*YA(IK:KP,11 );
END;
CB=GINV(LS1);
BETA1=CB*LS2;
SEB1=SQRT(VECDIAG(CB));
CBO=GG*LSO*GG;
SEB01=SQRT(VECDIAG(CBO));
IF TEST > 0 THEN DO;
HTEST1=J(TEST,2,O);
11=1; 12=R(11,1 I);
DO K=l TO TEST;
HTEST1(IK,11)=(H( 111:12, 1)*BETA1-DL(111:12, I ))'*
INV (H( I I 1: 12, 1)*CB*H ( I I 1: 12, I ) , )*
(H( 111: 12, I )*BETA1-DL( 111: 12,1));
"IF K < TEST THEN DO;
11 =11 +R ( I K, 1 I );
12=12+R( IK+l, 11);
END;
END;
11=1; 12=R(11,11);
DO K=l TO TEST;
HTESTl ( I K, 21 )=(H ( I 11 : 12, , )*BO-DL ( I 11 : 12, I ) ) '*
INV(H( 111: 12, I )*CBO*H( 111: 12, I )')*
(H( I 11 : 12, I )*BO-DL ( I 11 : 12, I ) ) ;
IF K < TEST THEN DO;
I 1 =I 1+R ( I K, 1 I );
12= I 2+R ( I K+1, 1 I ) ;
END;
END;
END;
ELSE HTEST1=O;
FREE CB CBO LSO LS1 LS2;
END;
IF PT = 0 THEN DO;
IF TEST = 0 THEN HTEST1=0;
ELSE DO;
LSO=J(P,P,O);
LS1=LSO;
LS2=J(P,1,O);
DO K=l TO (A-l)*T+l BY T;
KP=K+T-1;
GP=GA(IK:KP,l:PI );
LSO=LSO+GP'*SHAT1*GP;
LS1=LS1+GP'*IS*GP;
LS2=LS2+GP'*IS*YA( IK:KP,l I);
END;
Page 74
CB=GINV{LS1);
BETA1=CB*LS2;
SEB1=SQRT{VECDIAG{CB»;
CBO=GG*LSO*GG;
SEB01=SQRT{VECDIAG{CBO»;
HTEST1=J{TEST,2,O);
11=1; I2=R{ll,11);
DO K=l TO TEST;
HTEST1{IK,1 1)={H{II1:I2, I )*BETA1-DL{ 111:12, I »'*
INV{H{ 111:12,1 )*CB*H{II1:I2,1)')*
{H( I 11 : 12, I )*BETA1-DL ( I 11 : 12, I ) ) ;
IF K < TEST THEN DO;
11 =11 +R ( I K, 1 I ) ;
I2=I2+R{ I K+l, 11);
END;
END;
11=1; I2=R(11,11);
DO K=l TO TEST;
HTESn ( 1K, 21 )={H ( I 11 : 12, I )*BO-DL ( I 11 : 12, I ) ) '*
INV{H{II1:I2, I )*CBO*H{ 111:12, I )')*
{H( I 11 : 12, I )*BO-DL ( I 11 : 12, I ) ) ;
IF K < TEST THEN DO;
I 1=I 1+R ( I K, 1 I ) ;
12= I 2+R ( I K+1, 1 I ) ;
END;
END;
FREE CB CBO LSO LS1 LS2;
END;
END;
FREE SHAn;
LAM1=LAM1+LAM1C-A*C*LOG{4*ARSIN{l»+A*B*C*LOG(B)-A*C*{B-1)*LOG{B-l);
CHI11=O;
CHI21=O;
*--- STATISTICS FOR MODEL-2
BANDED MODEL ---;
LOAD SHAT2 SHAT2C;
RUN STAT{LAM2,CHI12,CHI22,MEB2,SHAT2B,PSI,PHI,A,B,C,SHAT2,SHAT2C,
LAM2C,IV,SHAT1ST,BETA2,SEB2,SEB02,YA,GA,P,PT,HTEST2,H,TEST,R,OL,BO,GG);
FREE SHAT2C LAM2C SHAT2;
. STORE SHAT2B;
*--- STATISTICS FOR MODEL-3
PANTULA-POLLOCK AR{l) MODEL ---;
LOAD SHAT3 SHAT3C;
RUN STAT(LAM3,CHI13,CHI23,MEB3,SHAT3B,PSI,PHI,A,B,C,SHAT3,SHAT3C,
LAM3C,IV,SHAT1ST,BETA3,SEB3,SEB03,YA,GA,P,PT,HTEST3,H,TEST,R,DL,BO,GG);
FREE SHAT3C LAM3C SHAT3;
STORE SHAT3B;
*--- STATISTICS FOR MODEL-4A
SIMPLE AR(l) MODEL
Page 75
LOAD SHAT4A SHAT4AC;
RUN STAT(LAM4A,CHI14A,CHI24A,MEB4A,SHAT4AB,PSI,PHI,A,B,C,SHAT4A,
SHAT4AC,LAM4AC,IV,SHAT1ST,BETA4A,SEB4A,SEB04A,YA,GA,P,PT,HTEST4A,H,TEST,
R,DL,BO,GG)i
FREE SHAT4AC LAM4AC SHAT4A;
STORE SHAT4AB;
*---
STATISTICS FOR MODEL-4B
SPLIT-PLOT MODEL ---;
LOAD SHAT4B SHAT4BC;
RUN STAT(LAM4B,CHI14B,CHI24B,MEB4B,SHAT4BB,PSI,PHI,A,B,C,SHAT4B,
SHAT4BC,LAM4BC,IV,SHAT1ST,BETA4B,SEB4B,SEB04B,YA,GA,P,PT,HTEST4B,H,TEST,
R, DL, BO, GG) ;
FREE SHAT4BC LAM4BC SHAT4Bi
STORE SHAT4BB;
FREE PSI PHI IV SHAT1ST YA GA;
*---
PRINTOUT OF FINAL STATISTICS ---;
PRINT 'THE RESULTS FOR PART III -- THE COMBINED STATISTICS';
PRINT'
';
PRINT' ***---&&&---*** I;
IF TEST> 0 THEN DO;
PRINT 'THE LINEAR HYPOTHESES TEST STATISTICS AND THE BETAS USED IN THESE
TESTS' ;
BETA1=BETA1'; SEB1=SEB1'i SEB01=SEB01';
BETA2=BETA2'i SEB2=SEB2'i SEB02=SEB02'i
BETA3=BETA3'; SEB3=SEB3'; SEB03=SEB03'i
BETA4A=BETA4A'; SEB4A=SEB4A'; SEB04A=SEB04A';
BETA4B=BETA4B'; SEB4B=SEB4B'; SEB04B=SEB04B';
BETAS=BETAS'; SEBS=SEBS'i SEBOS=SEBOS';
PRINT I;
PRINT HTEST1 (IROWNAME=BLK COLNAME=BLKI); FREE HTEST1i
PRINT BETA1 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB1 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB01 (IROWNAME=BLK COLNAME=BLKI);
PRINT HTEST2 (IROWNAME=BLK COLNAME=BLKI); FREE HTEST2;
PRINT BETA2 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB2 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB02 (IROWNAME=BLK COLNAME=BLKI);
PRINT HTEST3 (IROWNAME=BLK COLNAME=BLKI); FREE HTEST3;
PRINT BETA3 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB3 (IROWNAME=BLK COLNAME=BLKI)i
PRINT SEB03 (IROWNAME=BLK COLNAME=BLKI);
PRINT HTEST4A (IROWNAME=BLK COLNAME=BLKI); FREE HTEST4A;
PRINT BETA4A (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB4A (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB04A (IROWNAME=BLK COLNAME=BLKI);
PRINT HTEST4B (IROWNAME=BLK COLNAME=BLKI); FREE HTEST4B;
PRINT BETA4B (IROWNAME=BLK COLNAME=BLKI);
Page 76
PRINT SEB4B (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB04B (IROWNAME=BLK COLNAME=BLKI);
PRINT HTEST5 (IROWNAME=BLK COLNAME=BLKI); FREE HTEST5;
PRINT BETA5 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB5 (IROWNAME=BLK COLNAME=BLKI);
PRINT SEB05 (IROWNAME=BLK COLNAME=BLKI);
FREE BETAl BETA2 BETA3 BETA4A BETA4B BETAS SEBl SEB2 SEB3 SEB4A SEB4B
SEB5 SEBOl SEB02 SEB03 SEB04A SEB04B SEB05;
END;
PRINT
'THE VARIANCE-COVARIANCE MATRIX = I(B)@SHATW+J(B,B,l)@SHATB';
PRINT 'WHERE SHATW=SHAT*B/(B-l)';
LOAD;
PRINT SHAT1B (IROWNAME=BLK COLNAME=BLKI); FREE SHAT1B;
PRINT MEBl (IROWNAME=BLK COLNAME=BLKI);
PRINT SHAT2B (IROWNAME=BLK COLNAME=BLKI); FREE SHAT2B;
PRINT MEB2 (IROWNAME=BLK COLNAME=BLKI);
PRINT SHAT3B (IROWNAME=BLK COLNAME=BLKI); FREE SHAT3B;
PRINT MEB3 (IROWNAME=BLK COLNAME=BLKI);
PRINT SHAT4AB (IROWNAME=BLK COLNAME=BLKI);
PRINT MEB4A (IROWNAME=BLK COLNAME=BLKI);
PRINT SHAT4BB (IROWNAME=BLK COLNAME=BLKI);
PRINT MEB4B (IROWNAME=BLK COLNAME=BLKI)i
PRINT SHAT5B (IROWNAME=BLK COLNAME=BLKI);
PRINT MEBS (IROWNAME=BLK COLNAME=BLKI);
FREE SHAT3B
SHAT4AB SHAT4BB SHATSB;
NP1=P+2*(C*(C+l)/2);
NP2=P+2*C;
NP3=P+2*3;
NP4=P+2*2;
NP5=P+2*1;
PRINT I;
PRINT 'THE MINUS TWO LAMBDA STATISTICS AND THE NUMBER OF PARAMETERS';
PRINT LAMl (IROWNAME=BLK COLNAME=BLKI)
NPl (\ROWNAME=BLK COLNAME=BLKI);
Page 77
PRINT LAM2 (IROWNAME=BLK COLNAME=BLKI)
NP2 (IROWNAME=BLK COLNAME=BLKI);
PRINT LAM3 (IROWNAME=BLK COLNAME=BLKI)
NP3 (IROWNAME=BLK COLNAME=BLKI);
PRINT LAM4A (IROWNAME=BlK COlNAME=BlKI)
lAM4B (IROWNAME=BlK COlNAME=BLKI)
NP4 (IROWNAME=BlK COLNAME=BLK\);
PRINT LAM5 (IROWNAME=BlK COlNAME=BlKI)
NP5 (IROWNAME=BlK COlNAME=BlKI);
PRINT 'THE CHISQUARE STATISTICS';
PRINT CHI11 (IROWNAME=BLK COLNAME=BLKI)
CHI21 (IROWNAME=BLK COlNAME=BLKI);
PRINT CHI12 (IROWNAME=BlK COlNAME=BlKI)
CHI22 (IROWNAME=BlK COlNAME=BLKI);
PRINT CHI13 (IROWNAME=BlK COlNAME=BlKI)
CHI23 (IROWNAME=BLK COlNAME=BLKI);
PRINT CHI14A (IROWNAME=BlK COLNAME=BLKI)
CHI24A (IROWNAME=BLK COLNAME=BLKI)
CHI14B (IROWNAME=BLK COLNAME=BLKI)
CHI24B (\ROWNAME=BLK COLNAME=BLKI);
PRINT CHI15 (IROWNAME=BLK COlNAME=BLKI)
CHI25 (IROWNAME=BLK COlNAME=BlKI);
*--- ESTIMATION OF THE PANTUlA-POLlOCK AR(1) PARAMETERS ---;
ESG=B*TH3(11,11 )/(B-1);
ESEP=B*TH3( 11,21 )/(B-1);
EAlEP=TH3( 11,31);
ESV=THA( 11,1\)-ESG/B;
ESD=THA( 12,1 I);
EAlD=THA( 13,1 I);
FREE TH3;
*--- APPROXIMATE STANDARD ERRORS FOR THE ABOVE ESTIMATES ---;
SESG=B*SETH3(11,1\)/(B-1);
SESEP=B*SETH3(11,21 )/(B-1);
SEAlEP=SETH3(11,31);
FREE SETH3;
SESV=SQRT(SETHA(11,1 I )**2+(SESG**2)/(B**2));
SESD=SETHA( 12,1 I);
SEALD=SETHA( 13,11);
PRINT /;
Page 78
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
'THE ESTIMATES AND STANDARD ERRORS OF THE PARAMETERS IN'
'THE PANTULA-POLLOCK AR(l) VAR-COV STRUCTURE'j
ESV SESVj
ESD SESD;
EALo SEALo;
ESG SESG;
ESEP SESEP;
EALEP SEALEP;
IF TEST = a THEN 00;
IF PT > a THEN DOj
PRINT /j
PRINT 'THE FINAL ESTIMATES FOR THE MEANS';
BETA1=BETA1~; SEB1=SEB1'i SEB01=SEB01';
BETA2=BETA2'; SEB2=SEB2'; SEB02=SEB02';
BETA3=BETA3'j SEB3=SEB3'; SEB03=SEB03'j
BETA4A=BETA4A'; SEB4A=SEB4A'; SEB04A=SEB04A';
BETA4B=BETA4B'; SEB4B=SEB4B'j SEB04B=SEB04B'j
BETA5=BETA5'; SEB5=SEB5'; SEB05=SEBOS';
PRINT BETAl (IROWNAME=BLK COLNAME=BLKI)
SEBl (IROWNAME=BLK COLNAME=BLKI)
SEBOl (IROWNAME=BLK COLNAME=BLKI);
PRINT BETA2 (IROWNAME=BLK COLNAME=BLKI)
SEB2 (IROWNAME=BLK COLNAME=BLKI)
SEB02 (IROWNAME=BLK COLNAME=BLKI);
PRINT BETA3 (IROWNAME=BLK COLNAME=BLKI)
SEB3 (/ROWNAME=BLK COLNAME=BLKI)
SEB03 (IROWNAME=BLK COLNAME=BLKI)j
PRINT BETA4A (IROWNAME=BLK COLNAME=BLKI)
SEB4A (IROWNAME=BLK COLNAME=BLKI)
SEB04A (IROWNAME=BLK COLNAME=BLKI);
PRINT BETA4B (IROWNAME=BLK COLNAME=BLKI)
SEB4B (IROWNAME=BLK COLNAME=BLKI)
SEB04B (IROWNAME=BLK COLNAME=BLKI)j
PRINT BETA5 (IROWNAME=BLK COLNAME=BLKI)
SEBS (IROWNAME=BLK COLNAME=BLKI)
SEBOS (IROWNAME=BLK COLNAME=BLKI);
END;
PRINT '*** THE END OF PRINTOUTS *** '.,
END;
ENDj
START STAT(LAM,CHI1,CHI2,MEB,SIGMAB,PSI,PHI,A,B,C,SIGMA,SIGMAC,
LAMC,IV,SHAT1ST,BETA,SEB,SEBO,YA,GA,P,PT,HTEST,H,TEST,R,oL,BO,GG);
T=B*C;
IS=INV(SIGMA*B/(B-l»;
IS=I(B)@IS+J(B,B,l/B)@(INV(SIGMAC*B}-IS);
IVI=A/2*PHI'*(IS@IS)*PHI;
j
Page 79
SIGMAB=SIGMAC-SIGMA/(B-l);
MEB=MIN(EIGVAL(SIGMAB));
SIGMA=I(B)@(SIGMA*B/(B-l))+J(B,B,l)@SIGMAB;
E=SHAT1ST-PSI*SHAPE(SIGMA,T*T,1);
LAM=LAM+LAMC-A*C*LOG(4*ARSIN(1))+A*B*C*LOG(B)-A*C*(B-l)*LOG(B-l);_
CHI1=E'*IV*E;
CHI2=E'*IVI*E;
IF PT > 0 THEN DO;
LSO=J(P,P,O);
LS1=LSO;
LS2=J(P,1,0);
DO K=l TO (A-l)*T+l BY T;
KP=K+T-l;
GP=GA(IK:KP,l:PI );
LSO=LSO+GP'*SIGMA*GP;
LS1=LS1+GP'*IS*GP;
LS2=LS2+GP'*IS*YA( IK:KP,l I);
END;
CB=GINV(LS1);
BETA=CB*LS2;
IF BO=-l THEN BO=BETA;
SEB=SQRT(VECDIAG(CB));
CBO=GG*LSO*GG;
SEBO=SQRT(VECDIAG(CBO));
IF TEST> 0 THEN DO;
HTEST=J(TEST,2,0);
11=1; I2=R( 11,11);
DO K=l TO TEST;
HTEST ( I K, 1 I ) =(H ( I 11 : 12, I )*BETA-DL ( I 11 : 12, I ) ) '*
INV(H( 111: 12, I )*CB*H( 111: 12, I )')*
(H( 111 :12, I )*BETA-DL( 111 :12, I));
IF K < TEST THEN DO;
11 =I 1+R ( I K, 1 I ) ;
I2=12+R( I K+l, 11);
END;
END;
11=1; 12=R(ll,11);
DO K=l TO TEST;
HTEST ( 1K, 21 )=(H ( I 11 : 12, I )*BO-DL ( I 11 : 12, I )) '*
INV(H( 111:12,' )*CBO*H( 111:12, I )')*
(H( 111 :12, I )*BO-DL( 111 :12, I));
IF K < TEST THEN DO;
I 1=I 1 +R ( I K, 1 I ) ;
I2=I2+R( I K+1, 11);
END;
END;
END;
ELSE HTEST=O;
FREE CB CBO LSO LSl LS2;
END;
IF PT = 0 THEN DO;
IF TEST = 0 THEN DO; HTEST=O; GOTO RETURNN;
ELSE DO;
LSO=J(P,P,O);
LS1=LSO;
LS2=J(P,1,0);
END;
Page 80
DO K=1 TO (A-1)*T+1 BY T;
KP=K+T-1;
GP=GA(IK:KP,1:PI );
LSO=LSO+GP'*SIGMA*GP;
LS1=LS1+GP'*IS*GP;
LS2=LS2+GP'*IS*YA( IK:KP,11);
END;
CB=GINV(LS1);
BETA=CB*LS2;
IF BO=-l THEN BO=BETA;
SEB=SQRT(VECDIAG(CB»;
CBO=GG*LSO*GG;
SEBO=SQRT(VECDIAG(CBO»;
HTEST=J(TEST,2,0);
11=1; I2=R(11,11);
DO K=1 TO TEST;
HTEST ( I K, 1 I )=(H ( 111 : 12, I )*BETA-DL ( I 11 : 12, I ) ) '*
INV(H(II1:I2, 1)*CB*H(II1:I2, I )')*
(H(II1:I2, I )*BETA-DL(II1:I2, I »;
IF K < TEST THEN DO;
Il=Il+R( I K, 11);
12= I 2+R ( I K+1, 1 I ) ;
END;
END;
11=1; 12=R(ll,11);
DO K=1 TO TEST;
HTEST ( IK, 21 )=(H ( I 11 : 12, I )*BO-DL ( I 11 : 12, I ) ) '*
INV(H(II1:I2, I )*CBO*H(II1:I2, I )')*
(H ( I 11 : 12, I )*BO-DL ( I r 1: 12, I ) ) ;
IF K < TEST THEN DO;
I 1=I 1+R ( I K, 1 I ) ;
I2=I2+R( I K+l, 11);
END;
END;
FREE CB CBO LSD LSl LS2;
END;
END;
RETURNN:
FREE IS SIGMA;
FINISH;
FINISH;
RUN REMACRB;
© Copyright 2026 Paperzz