Learn R Programming

nopaco (version 1.0.9)

concordance.test: Perform a nonparametric concordance test.

Description

concordance.test performs a test for a random concordance (if a single matrix is given) or tests for equal concordance between two matrices.

Usage

concordance.test(x, y = NULL, alternative = NULL, alpha = 0.05, ...)

Value

An object of ConcordanceTest-class

Arguments

x

a numeric matrix, subjects in the rows, repeated measurements in the columns

y

(optional) a numeric matrix of equal size as argument x

alternative

"less", "greater" or "two.sided". Only used when y is given.

alpha

significance level (default = 0.05)

...

see details

Details

  • Testing the deviation from random concordance: if only one matrix is given (i.e. argument x), its concordance will be tested against the alternative hypothesis of finding a higher concordance under random sampling conditions. For small matrices (depending on number of replicate measurements) an exact method will be used to determine a p-value. In case of larger matrices, where the exact approach in not feasible, either the revised-beta approach (default), a beta approximation, or a normal approximation is used. To enforce the use of either one method, the method argument can be used with value "exact","Rbeta","beta" or "normal".

  • Testing for a difference between concordances: if both arguments x and y have been given, the equality of concordances of both matrices is tested. The default alternative hypothesis is 'two.sided'. Both matrices must be of equal size and have corresponding missing entries (NA values). In case of missing data in one matrix, the same entries in the other matrix will also be set to missing. This method involves bootstrapping to estimate variance and confidence estimates, with adjustable options via the global R options "nopaco.nCPU" (default=2), "nopaco.nDraws.CI" (default=1e4) and "nopaco.seed" (default = 1).

Unbalanced data due to randomly missing data or an unequal number of repeated measurements per subject is allowed. In that case, missing or unknown values must be set to NA.

References

P.Rothery (1979) Biometrika 66(3):629-639

See Also

Other concordance functions: coef(), getPsi(), rfromPsi()

Examples

Run this code
require(MASS) ##to use the 'mvrnorm' function

#Generate a matrix without concordance
# for three observers in two samples
matRandom <- matrix(rnorm(3*20),20,3)
concordance.test(matRandom) 

#Generate a corresponding matrix with strong concordance
sigma<-matrix(0.8,3,3)
diag(sigma)<-1
matConcordant <- mvrnorm(20,mu=rep(0,3),Sigma=sigma)
concordance.test(matConcordant)

#Test concordances between the two matrices
aTest <- concordance.test(matConcordant, matRandom)

getPsi(aTest)
coef(aTest)

Run the code above in your browser using DataLab