Title: | Non-Parametric Concordance Coefficient |
---|---|
Description: | A non-parametric test for multi-observer concordance and differences between concordances in (un)balanced data. |
Authors: | Rowan Kuiper [cre, aut] , Remco Hoogenboezem [aut], Sjoerd Huisman [ctb] , Pieter Sonneveld [ths], Mark van Duin [ths] |
Maintainer: | Rowan Kuiper <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.9 |
Built: | 2024-12-16 06:32:56 UTC |
Source: | CRAN |
Extracts argument values from a ConcordanceTest-class
object
## S4 method for signature 'ConcordanceTest' x$name
## S4 method for signature 'ConcordanceTest' x$name
x |
An object of |
name |
The argument to get the value of |
The value of the requested argument
matRandom <- matrix(rnorm(3*20),20,3) testResult <- concordance.test(matRandom) names(testResult) testResult$psi
matRandom <- matrix(rnorm(3*20),20,3) testResult <- concordance.test(matRandom) names(testResult) testResult$psi
coef
extract the test results from the results of a concordance.test
## S4 method for signature 'ConcordanceTest' coef(object, ...)
## S4 method for signature 'ConcordanceTest' coef(object, ...)
object |
An object of |
... |
Not used |
A matrix
Other concordance functions:
concordance.test()
,
getPsi()
,
rfromPsi()
matRandom <- matrix(rnorm(3*20),20,3) testResult <- concordance.test(matRandom) getPsi(testResult) coef(testResult)
matRandom <- matrix(rnorm(3*20),20,3) testResult <- concordance.test(matRandom) getPsi(testResult) coef(testResult)
concordance.test
performs a test for a random concordance (if a single matrix is given) or tests for equal concordance between two matrices.
concordance.test(x, y = NULL, alternative = NULL, alpha = 0.05, ...)
concordance.test(x, y = NULL, alternative = NULL, alpha = 0.05, ...)
x |
a numeric matrix, subjects in the rows, repeated measurements in the columns |
y |
(optional) a numeric matrix of equal size as argument |
alternative |
"less", "greater" or "two.sided". Only used when |
alpha |
significance level (default = 0.05) |
... |
see 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
.
An object of ConcordanceTest-class
P.Rothery (1979) Biometrika 66(3):629-639
Other concordance functions:
coef()
,
getPsi()
,
rfromPsi()
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)
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)
This class stores results obtained from a concordance test.
Class ConcordanceTest
stores results from a concordance test.
pvalue
The pvalue
psi1
The concordance in matrix x
psi2
The concordance in matrix y
method
The method used to obtain the pvalue
alternative
The alternative hypothesis
ci.lower
The lower confidence boudary
ci.upper
The upper confidence boudary
ci.method
The method used to obtain the confidence interval
alpha
The significance level
call
The call made to the concordance.test
function
getPsi
returns the concordance coefficient(s) from a matrix or a result obtained by the concordance.test
function.
getPsi(x, y, ...) ## S4 method for signature 'ConcordanceTest,missing' getPsi(x) ## S4 method for signature 'matrix,missing' getPsi(x, y, ...) ## S4 method for signature 'data.frame,missing' getPsi(x, y, ...) ## S4 method for signature 'data.frame,data.frame' getPsi(x, y, ...) ## S4 method for signature 'matrix,NULL' getPsi(x, y, ...) ## S4 method for signature 'matrix,matrix' getPsi(x, y, ...)
getPsi(x, y, ...) ## S4 method for signature 'ConcordanceTest,missing' getPsi(x) ## S4 method for signature 'matrix,missing' getPsi(x, y, ...) ## S4 method for signature 'data.frame,missing' getPsi(x, y, ...) ## S4 method for signature 'data.frame,data.frame' getPsi(x, y, ...) ## S4 method for signature 'matrix,NULL' getPsi(x, y, ...) ## S4 method for signature 'matrix,matrix' getPsi(x, y, ...)
x |
A numeric matrix or an object |
y |
A numeric matrix (optional) |
... |
Not used |
A numeric vector with coefficient(s)
P.Rothery (1979) Biometrika 66(3):629-639
Other concordance functions:
coef()
,
concordance.test()
,
rfromPsi()
matRandom <- matrix(rnorm(30),10,3) testResult <- concordance.test(matRandom) getPsi(testResult) getPsi(matRandom)
matRandom <- matrix(rnorm(30),10,3) testResult <- concordance.test(matRandom) getPsi(testResult) getPsi(matRandom)
names
extracts argument names from a ConcordanceTest-class
object
## S4 method for signature 'ConcordanceTest' names(x)
## S4 method for signature 'ConcordanceTest' names(x)
x |
An object of |
A character vector
matRandom <- matrix(rnorm(3*20),20,3) testResult <- concordance.test(matRandom) names(testResult)
matRandom <- matrix(rnorm(3*20),20,3) testResult <- concordance.test(matRandom) names(testResult)
Convertion between Pearson correlation and the non paramtric concordance coefficient
rfromPsi(psi) psifromR(r)
rfromPsi(psi) psifromR(r)
psi |
a (vector of) non paramtric concordance coefficient(s) |
r |
a (vector of) Pearson correlation coefficient(s) |
The convertion is performed following the relationship described by Rothery (1979).
2*cos(pi*(1-psi))-1
A (vector of) corresponding Pearson correlation coefficient(s).
Rothery, P. 'A nonparametric measure of intraclass correlation', Biometrika, 66, 3, 629-639 (1979).
Other concordance functions:
coef()
,
concordance.test()
,
getPsi()
#Generate a matrix without concordance matRandom <- matrix(rnorm(30),10,3) result<-concordance.test(matRandom) getPsi(result) #concordance coefficient result$ci #95% confidence interval #Corresonding Pearson correlation rfromPsi(getPsi(result)) rfromPsi(result$ci) #Plot the relation between Pearson correlation and the nonparamatric concordance coefficient. r<-seq(-1,1,0.01) psi<-psifromR(r) plot(r,psi,type='l',xlab="Pearson correlation", ylab="nonparametric concordance")
#Generate a matrix without concordance matRandom <- matrix(rnorm(30),10,3) result<-concordance.test(matRandom) getPsi(result) #concordance coefficient result$ci #95% confidence interval #Corresonding Pearson correlation rfromPsi(getPsi(result)) rfromPsi(result$ci) #Plot the relation between Pearson correlation and the nonparamatric concordance coefficient. r<-seq(-1,1,0.01) psi<-psifromR(r) plot(r,psi,type='l',xlab="Pearson correlation", ylab="nonparametric concordance")
This data is generated as explained in the nopaco vignette. It represents the outcomes of the risk models (model A and model B). Both models were applied to gene expression profiles 100 subjects, each run in duplo.
data(scores)
data(scores)
A list with two elements named 'modelA' and 'modelB' both containing a dataframe with outcome scores for 100 subjects in the rows each having two replicate measurements in the columns.
vignette("nopaco", package = "nopaco")
data(scores) str(scores) plot(scores[['modelA']]) plot(scores[['modelB']])
data(scores) str(scores) plot(scores[['modelA']]) plot(scores[['modelB']])