eqCorTestByRows: Correlation matrices test by rows

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/equalityCorrelationsTestByRows.r

Description

Tests whether the gth row of a correlation matrix is either non-zero or different to the same row of another correlation matrix. Allows for paired data.

Usage

1
2
eqCorTestByRows(D1, D2 = NULL, testStatistic = c("AS", "max"), nite = 200, 
                paired = FALSE, exact = TRUE, whichRows = NULL, conf.level = 0.95, ...)

Arguments

D1

first population dataset in matrix n_1\times p form.

D2

second population dataset in matrix n_2\times p form. If D2 = NULL non-zero correlation rows test is performed instead.

testStatistic

test statistic used for the hypothesis testing: name that uniquely identifies "AS" for average of squares based test and "max" for an extreme value test.

nite

number of iterations used to generate the permuted samples.

paired

if TRUE, observations in D1 and D2 are assumed to be matched (n_1 must be equal to n_2).

exact

permuted samples method: if TRUE it forces to have the exact same number of observations in the two conditions in the samples exchanging process. If FALSE, permutations are made exchanging matched observations from the two datasets randomly with probability equal to 0.5.

whichRows

vector with the rows in the correlation matrix that are tested. If NULL, all rows are tested.

conf.level

confidence level of the interval.

...

arguments passed to or from other methods to the low level.

Details

This test uses a sum of squares based test statistic as given by the adjusted squared correlation cor2mean.adj as well as an extreme value based test statistic as given by max.

Null distributions are approximated differently when testing equality of two correlation rows and testing if correlation rows are equal to zero. In the first case, permuted samples are used to construct the confidence interval (see details in eqCorrMatTest). In the latter, they are found using Monte Carlo samples. For instance, n iid observations from a normal distribution N(0,1) are generated. Then, the adjusted square (or absolute maximum) correlations between these montecarlo samples and the original data D1 are found.

Value

An object of class eqCorTestByRows containing the following components:

AStest

average of squares test statistics.

pvalAS

average of squares test p-values.

ciAS

average of of squares test statistic confidence interval.

Maxtest

extreme value test statistics.

pvalMax

extreme value test p-values.

ciMax

extreme value test statistic confidence interval.

Author(s)

Caballe, Adria <a.caballe@sms.ed.ac.uk>, Natalia Bochkina and Claus Mayer.

References

to come.

See Also

plot.eqCorTestByRows for graphical representation.
eqCorrMatTest for testing equality of two correlation matrices.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#### data
EX2 <- pcorSimulatorJoint(nobs = 200, nclusters = 3, nnodesxcluster = c(60,40,50), 
                          pattern = "pow", diffType = "cluster", dataDepend = "diag", 
                          pdiff = 0.5)
			               
#### eq corr by rows
## not run
#test1 <- eqCorTestByRows(EX2$D1, EX2$D2, testStatistic = c("AS", "max"), 
#                         nite = 200, paired = TRUE, exact = TRUE, 
#                         whichRows = c(1:40), conf.level = 0.95)
#print(test1)

#### zero corr by rows
#test2 <- eqCorTestByRows(EX2$D1, testStatistic = c("AS", "max"), nite = 1000, 
#                         conf.level = 0.95)
#print(test2)

ldstatsHD documentation built on Aug. 14, 2017, 5:06 p.m.