1. Home
  2. RPAIR procedure

RPAIR procedure

Gives t-tests for all pairwise differences of means from a regression or generalized linear model (J.T.N.M. Thissen & P.W. Goedhart).

Options

PRINT = string tokens What to print (differences, sed, tvalues, tprobabilities); default diff, sed, tval
SORT = string token Whether to sort the means into ascending order (no, yes); default no
COMBINATIONS = string token Which combinations of factors in the current model to include (full, present, estimable); default esti (similar to the PREDICT directive)
ADJUSTMENT = string token Type of adjustment with linear regression models (marginal, equal); default marg (similar to the PREDICT directive)
WEIGHTS = table Weights classified by some or all standardizing factors; default * (similar to the PREDICT directive)
METHOD = string token Method of forming margin (mean, total); default mean (similar to the PREDICT directive)
ALIASING = string token How to deal with aliased parameters (fault, ignore); default faul (similar to the PREDICT directive)
SAVE = identifier Specifies save structure of model to display; default * (i.e. that of the latest model fitted)

Parameters

TREATFACTORS = pointers Each pointer contains a list of treatment factors classifying the table of means to be compared (the right-most factor changes fastest, then the second from the right, etc.); this parameter must be set
LABELS = texts Structures containing strings to label rows (and columns) of the symmetric matrices of pairwise differences etc; the length of the text must equal the product of the numbers of factor levels as implied by the factor list in the TREATFACTORS pointer
NEWLABELS = texts To save the row labels of the DIFFERENCES, SED, TVALUES and TPROBABILITIES matrices
DIFFERENCES = symmetric matrices To save pairwise differences (treatment means on the diagonal)
SED = symmetric matrices To save standard errors of the pairwise differences (missing values on the diagonal)
TVALUES = symmetric matrices To save t-values (missing values on the diagonal)
TPROBABILITIES = symmetric matrices To save t-probabilities (missing values on the diagonal)

Description

When analysing a (non-orthogonal) analysis of variance model or a generalized linear model (GLM) with the regression directives FIT, ADD etc., effects of factors in the model and their interactions if required, may be assessed from a suitable analysis of variance (deviance) table. With the PREDICT directive tables of estimated means and their standard errors can be obtained, but not standard errors of differences of means. The RPAIR procedure provides additional information on such tables by calculating t-values and corresponding two-sided t-probabilities for tests of all pairwise differences of means.

The t-statistics used are based on the residual variance (deviance) and its degrees of freedom from the current regression model. However, if the DISPERSION option of the MODEL directive has been set to a numerical value (as is by default the case with a GLM with binomial, poisson or multinomial distribution), the degrees of freedom are set to 10000, approximating to the normal distribution.

It is assumed that the MODEL statement for the regression has defined only one response variate.

The TREATFACTORS parameter must be set to a pointer containing a list of factors classifying the table of means which are to be compared.

The PRINT option controls the output. By default a symmetric matrix of pairwise differences of means is printed with the means themselves down the diagonal. With a GLM these means and their pairwise differences are always calculated on the linear scale. The corresponding symmetric matrices of standard errors and of t-values are printed by default too.

The matrix rows (and columns) are ordered such that the right-most factor changes fastest, then the second from the right, etc. This default order can be changed by setting the SORT option to yes, in which case rows and columns of all matrices are rearranged to put the means on the diagonal of the matrix of differences into ascending order.

The LABELS parameter can be used to label the rows and columns of the matrices, which are then taken in default order. When the LABELS parameter has not been set and the TREATFACTORS pointer contains just one factor, by default the labels or levels of the factor are used for labeling; when the pointer contains more than one factor, the default row (and column) labels are combinations of factor settings indicated by the first letter of the factor identifier followed by an ordinal level.

The DIFFERENCES, SED, TVALUES and TPROBABILITIES parameters can be used to save the output. The row labels of these matrices can be saved through the NEWLABELS parameter.

The COMBINATIONS, ADJUSTMENT, WEIGHTS, METHOD, ALIASING and SAVE options are as in the PREDICT directive.

Options: PRINT, SORT, COMBINATIONS, ADJUSTMENT, WEIGHTS, METHOD, ALIASING, SAVE.

Parameters: TREATFACTORS, LABELS, NEWLABELS, DIFFERENCES, SED, TVALUES, TPROBABILITIES.

Method

The procedure uses the PREDICT directive to save a table of predictions and corresponding variance-covariance matrix. With a GLM the setting of option BACKTRANSFORM of the PREDICT directive is always none.

Action with RESTRICT

Any restrictions applied to vectors used in the regression apply also to the results from RPAIR.

See also

Procedures: ALLDIFFERENCES, AMCOMPARISON, AUMCOMPARISON, PAIRTEST, PPAIR.

Commands for: Regression analysis.

Example

CAPTION 'RPAIR example',\
        !t('1) Data from Snedecor, G.W. & Cochran, W.G.',\
        '(1976). Statistical Methods (6th edition).',\
        'Iowa State University Press. Ames. page 480.'); STYLE=meta,plain
FACTOR  [LEVELS=5; VALUES=18(1),45(2),6(3),9(4),15(5)] Breed
FACTOR  [LABELS=!T(Male,Female); VALUES=12(1),6(2),30(1),15(2),\ 
        4(1),2(2),6(1),3(2),10(1),5(2)] Sex
VARIATE [NVALUES=93] %Dressng
READ    %Dressng
 13.3 12.6 11.5 15.4 12.7 15.7 13.2 15.0 14.3 16.5 15.0 13.7 18.2 11.3
 14.2 15.9 12.9 15.1 10.9  3.3 10.5 11.6 15.4 14.4 11.6 14.4  7.5 10.8
 10.5 14.5 10.9 13.0 15.9 12.8 14.0 11.1 12.1 14.7 12.7 13.1 10.4 11.9
 10.7 14.4 11.3 13.0 12.7 12.6 14.3 15.3 11.8 11.0 10.9 10.5 12.9 12.5
 13.0  7.6 12.9 12.4 12.8 10.9 13.9 13.6 13.1  4.1 10.8 12.9 14.4 11.6
 13.2 12.6 15.2 14.7 12.4 13.8 14.4  4.9 10.3 10.3 10.1  6.9 13.2 11.0
 12.2 13.3 12.9  9.9 12.8  8.4 10.6 13.9 10.0 :
MODEL   %Dressng
FIT     Breed * Sex
RPAIR   [PRINT= d, s, tv, tp] !P( Breed), !P( Sex, Breed)
RPAIR   [PRINT= d] !P( Breed), !P( Sex, Breed);\ 
        LABELS= !T( Breed1, Breed2, Breed3, Breed4, Breed5),\ 
        !T( MalBr1, MalBr2, MalBr3, MalBr4, MalBr5,\ 
            FemBr1, FemBr2, FemBr3, FemBr4, FemBr5)
" The next analysis of variance has been added for comparison."
TREATMENTS  Breed * Sex
ANOVA       [FPROBABILITY= yes] %Dressng
CAPTION !t('2) Data from Snedecor & Cochran (1980), Statistical Methods',\ 
        '(7th edition), page 289; also used by M.S. Ridout',\ 
        'in Genstat Newsletter 20, page 22.')
FACTOR  [NVALUES= 25; LEVELS= 5; VALUES= 5(1...5)] Rows
FACTOR  [LEVELS= 5; VALUES= (1...5)5] Cols
FACTOR  [LABELS= !T( K, M, N, O, P)] Treatmnt
VARIATE [NVALUES= 25] Wireworm
READ    Treatmnt, Wireworm; FREPRESENTATION= labels
 P   3   O   2   N   5   K   1   M   4
 M   6   K   0   O   6   N   4   P   4
 O   4   M   9   K   1   P   6   N   5
 N  17   P   8   M   8   O   9   K   0
 K   4   N   4   P   2   M   4   O   8 :
MODEL   [DISTRIBUTION= poisson] Wireworm
FIT     Rows + Cols + Treatmnt
RPAIR   [PRINT= d, s, tv, tp] !P(Treatmnt)       " normal probabilities "
MODEL   [DISTRIBUTION= poisson; DISPERSION= *] Wireworm
FIT     Rows + Cols + Treatmnt
RPAIR   [PRINT= d, s, tv, tp] !P(Treatmnt)       " t probabilities "
RPAIR   [SORT= yes; PRINT= *] !P(Treatmnt); NEWLABELS= Labels;\ 
        DIFF= Diff; SED= Sed; TVALUES= Tval; TPROB= Pval
PRINT   [RLPRINT=*] Labels
&       [SERIAL= yes; RLPRINT=labels] Diff, Sed, Tval, Pval
Updated on March 5, 2019

Was this article helpful?