kepner_robinson_test {pseudorank} | R Documentation |
Kepner-Robinson Test
Description
This function calculates the Kepner-Robinson test using ranks under the null hypothesis H0F: F_1 = ... F_k where F_i are the marginal distributions. Each subject needs to have k measurements. This test assumes that the covariance matrix of a subject has a compound symmetry structure.
Usage
kepner_robinson_test(x, ...)
## S3 method for class 'numeric'
kepner_robinson_test(
x,
time,
subject,
na.rm = FALSE,
distribution = c("Chisq", "F"),
...
)
## S3 method for class 'formula'
kepner_robinson_test(
formula,
data,
subject,
na.rm = FALSE,
distribution = c("Chisq", "F"),
...
)
Arguments
x |
numeric vector containing the data |
... |
further arguments are ignored |
time |
factor specifying the groups |
subject |
factor specifying the subjects or the name of the subject column if a data.frame is used |
na.rm |
a logical value indicating if NA values should be removed |
distribution |
either 'Chisq' or 'F' approximation |
formula |
optional formula object |
data |
optional data.frame of the data |
Value
Returns an object of class 'pseudorank'
References
James L. Kepner & David H. Robinson (1988) Nonparametric Methods for Detecting Treatment Effects in Repeated-Measures Designs, Journal of the American Statistical Association, 83:402, 456-461.
Examples
# create some artificial data with 20 subjects measured at two time points
data <- rnorm(40)
time <- rep(c(1,2),20)
subject <- gl(20,2)
df <- data.frame(data=data,time=time,subject=subject)
kepner_robinson_test(data,time,subject)
kepner_robinson_test(data~time,data=df,subject="subject")