ROREX
Reorders the responses from a balanced complete experimental design.
Required Arguments
NL — Vector of length NF containing the number of levels for each of the NF factors. (Input)
NL(I) is the number of levels for the I-th factor.
IORD — Vector of length NF indicating the ordering of the responses in vector YIN. (Input)
IORD(I) = J means the model subscript corresponding to factor I is altering J-th most rapidly.
YIN — Vector of length NL(1) * NL(2) * * NL(NF) containing the responses in the order specified by IORD. (Input)
JORD — Vector of length NF indicating the new ordering of the responses in vector YOUT. (Input)
JORD (K) = L means the model subscript corresponding to factor K is altering L-th most rapidly.
YOUT — Vector of length NL(1) * NL(2) * * NL(NF) containing the responses in the order specified by JORD. (Output)
Optional Arguments
NF — Number of factors (number of subscripts) in the model, including error. (Input)
Default: NF = size (NL,1).
FORTRAN 90 Interface
Generic: CALL ROREX (NL, IORD, YIN, JORD, YOUT [])
Specific: The specific interface names are S_ROREX and D_ROREX.
FORTRAN 77 Interface
Single: CALL ROREX (NF, NL, IORD, YIN, JORD, YOUT)
Double: The double precision name is DROREX.
Description
Typically, responses from a balanced complete experimental design are stored in a pattern that takes advantage of the design structure, consequently, the full set of model subscripts is not needed to identify each response. Routine ROREX assumes the usual pattern, which requires that one model subscript changes most rapidly, another changes next most rapidly, and so on, throughout the input data vector YIN. In many programs, including IMSL programs for this kind of data, the computations and ordering of output are dependent on which subscripts are moving most rapidly relative to others, within the pattern, in the input data. Data may be available in a form that needs reordering within the pattern before entry to an analysis routine. Routine ROREX reorders data in YIN, as controlled by JORD, and returns the reordered data in YOUT.
Let k (stored in NF) be the number of factors, and for j = 1, 2, , k, let nj (stored as the j-th element of NL) be the number of levels in the j-th factor. Let the data in YIN be denoted by
where for j = 1, 2, , k, ij = 1, 2, , nj. For every response in YIN, let pr denote the model subscript ij that is altering r-th most rapidly for r and j in the set {1, 2, , k} For every response in YOUT, let qs have a similar definition. Let Pr and Qs equal the number of levels for the factor whose model subscript is altering r-th and s-th most rapidly in YIN and YOUT, respectively.
The m-th element of YIN, denoted by
with
can be found using p1 given by
and then for r = 2, 3, , k, pr given by
The m-th element of YOUT, denoted by
is given by replacing the p’s by q’s in the formulas in the preceding equations.
Comments
Workspace may be explicitly provided, if desired, by use of R2REX/DR2REX. The reference is:
CALL R2REX (NF, NL, IORD, YIN, JORD, YOUT, IWK)
The additional argument is:
IWK — Work vector of length 4 * NF.
Example
The input responses yijk are ordered in YIN so that the subscript i varies most rapidly, j the next most rapidly, and k the least rapidly. Routine ROREX is used to reorder the responses into standard order, i.e., with the subscript i varying least rapidly, j the next most rapidly, and k the most rapidly.
 
USE ROREX_INT
USE WRRRL_INT
 
IMPLICIT NONE
INTEGER NF, NOBS
PARAMETER (NF=3, NOBS=24)
!
INTEGER IORD(NF), JORD(NF), NL(NF)
REAL YIN(NOBS), YOUT(NOBS)
CHARACTER CLABEL(1)*6, RLABEL(1)*4
DATA CLABEL/'NUMBER'/, RLABEL/'NONE'/
!
DATA NL/2, 3, 4/
DATA IORD/1, 2, 3/
DATA JORD/3, 2, 1/
DATA YIN/1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, &
11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, &
21.0, 22.0, 23.0, 24.0/
!
CALL ROREX (NL, IORD, YIN, JORD, YOUT)
!
CALL WRRRL ('YOUT', YOUT, RLABEL, CLABEL, 1, NOBS, 1, 0, '(F4.1)')
END
Output
 
YOUT
1 2 3 4 5 6 7 8 9 10 11 12 13
1.0 7.0 13.0 19.0 3.0 9.0 15.0 21.0 5.0 11.0 17.0 23.0 2.0
 
14 15 16 17 18 19 20 21 22 23 24
8.0 14.0 20.0 4.0 10.0 16.0 22.0 6.0 12.0 18.0 24.0