Ski.Mack: The Skillings-Mack test statistic

Description Usage Arguments Details Value Author(s) References Examples

View source: R/Ski.Mack.R

Description

The Skillings-Mack test statistic is a generalization of the statistic used in Friedman's ANOVA method and in Durbin's rank test. This nonparametric statistical test is useful for the data obtained from block designs with missing observations occurring randomly. The results are the Skillings-Mack statistic, p-values based on the chi-squared distribution and Monte Carlo method. The Monte Carlo method is recommended for approximating p-values when there are many ties and/or small designs with missing values are conducted.

Usage

1
Ski.Mack(y, groups=NULL, blocks=NULL, simulate.p.value = FALSE, B = 10000)

Arguments

y

Either a numeric vector of data values, or a data matrix. If a matrix is used, columns and rows are correspondent to blocks and treatments (groups), respectively.

groups

A vector containing group (treatment) indices for the corresponding y's which is a vector; this vector can be ignored if y is a matrix. Either a numeric or character vector is accepted.

blocks

A vector containing block indices for the corresponding y's; this vector can be ignored if y is a matrix. Either a numeric or character vector is accepted.

simulate.p.value

If TRUE, an estimated p-value based on the Monte Carlo method is calculated. The default is FALSE.

B

If simulate.p.value = TRUE, the default number of replications is 10,000.

Details

This function implements the Skilling-Mack test statistic for data obtained from block designs with missing observations. The skillings.mack function can also applied to balanced and partially balanced incomplete block designs. It reads a dataset in a format of a vector or a matrix and returns a p-value based on the chi-squared distribution. If simulate.p.value = TRUE, an estimated p-value based on Monte Carlo will be provided. If there are ties in a particular block, the average rank for those will be generated in simulating data under the null hypothesis.

Value

$Nblocks

a number of blocks in a design

$Ntreatments

a number of groups (treatments) in a design

$rawdata

a matrix containing the data that was read from y

$rankdata

a matrix containing ranks of the data

$varCovarMatrix

a variance-covariance matrix for adjusted treatment sums

$adjustedSum

an adjusted treatment sum for the j th treatment

Author(s)

Patchanok Srisuradetchai <s.patchanok@gmail.com>

References

Skillings, J.H., Mack, G.A.: On the Use of a Friedman-Type Statistic in Balanced and Unbalanced Block Designs. Technometrics 23(2), 171-177 (1981)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Skillings and Mack (1981), Table 1 page 173
## Comparison of four methods of assembling a product
B <- rep(c(1,2,3,4,5,6,7,8,9),rep(4,9))
G <- rep(c('A','B','C','D'),9)
y <- c(3.2,4.1,3.8,4.2,    3.1,3.9,3.4,4.0,	 4.3,3.5,4.6,4.8, 
       3.5,3.6,3.9,4.0,   3.6,4.2,3.7,3.9,   4.5,4.7,3.7, NA,
	     NA ,4.2,3.4,NA ,   4.3,4.6,4.4,4.9,   3.5, NA,3.7, 3.9)
Ski.Mack(y,groups = G,blocks = B)

## y is a matrix
maty <- matrix(
   c(3.2,4.1,3.8,4.2,		3.1,3.9,3.4,4.0,	 4.3,3.5,4.6,4.8, 
     3.5,3.6,3.9,4.0,   3.6,4.2,3.7,3.9,   4.5,4.7,3.7, NA,
	   NA ,4.2,3.4,NA ,   4.3,4.6,4.4,4.9,   3.5, NA,3.7, 3.9),
    ncol=9,byrow=FALSE)
Ski.Mack(maty, simulate.p.value = TRUE, B = 1000)

Example output

Skillings-Mack Statistic =  15.493049 , p-value =  0.001440 
Note: the p-value is based on the chi-squared distribution with d.f. =  3 

$Nblocks
[1] 9

$Ntreatments
[1] 4

$rawdata
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]  3.2  3.1  4.3  3.5  3.6  4.5   NA  4.3  3.5
[2,]  4.1  3.9  3.5  3.6  4.2  4.7  4.2  4.6   NA
[3,]  3.8  3.4  4.6  3.9  3.7  3.7  3.4  4.4  3.7
[4,]  4.2  4.0  4.8  4.0  3.9   NA   NA  4.9  3.9

$rankdata
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]    1    1    2    1    1    2  1.5    1    1
[2,]    3    3    1    2    4    3  2.0    3    2
[3,]    2    2    3    3    2    1  1.0    2    2
[4,]    4    4    4    4    3    2  1.5    4    3

$varCovarMatrix
     [,1] [,2] [,3] [,4]
[1,]   22   -7   -8   -7
[2,]   -7   21   -8   -6
[3,]   -8   -8   23   -7
[4,]   -7   -6   -7   20

$adjustedSum
             [,1]        [,2]         [,3]        [,4]
[1,] -14.12559752 4.281244146 -4.281244146 14.12559752


Skillings-Mack Statistic =  15.493049 , p-value =  0.001440 
Note: the p-value is based on the chi-squared distribution with d.f. =  3 
Based on B =  1000 , Simulated p-value =  0.000000 

$Nblocks
[1] 9

$Ntreatments
[1] 4

$rawdata
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]  3.2  3.1  4.3  3.5  3.6  4.5   NA  4.3  3.5
[2,]  4.1  3.9  3.5  3.6  4.2  4.7  4.2  4.6   NA
[3,]  3.8  3.4  4.6  3.9  3.7  3.7  3.4  4.4  3.7
[4,]  4.2  4.0  4.8  4.0  3.9   NA   NA  4.9  3.9

$rankdata
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]    1    1    2    1    1    2  1.5    1    1
[2,]    3    3    1    2    4    3  2.0    3    2
[3,]    2    2    3    3    2    1  1.0    2    2
[4,]    4    4    4    4    3    2  1.5    4    3

$varCovarMatrix
     [,1] [,2] [,3] [,4]
[1,]   22   -7   -8   -7
[2,]   -7   21   -8   -6
[3,]   -8   -8   23   -7
[4,]   -7   -6   -7   20

$adjustedSum
             [,1]        [,2]         [,3]        [,4]
[1,] -14.12559752 4.281244146 -4.281244146 14.12559752

Skillings.Mack documentation built on May 2, 2019, 10:10 a.m.