View source: R/EscoufierRVrarefy.R
RVrarefied | R Documentation |
Computes a rarefied estimate of the Escoufier RV coefficient to account for the dependence on sample size of RV, so that RV can be compared among groups with different number of observations (sample sizes)
RVrarefied(Block1, Block2, reps = 1000, samplesize)
Block1, Block2 |
Matrices or data frames containing each block of variables (observations in rows, variables in columns). |
reps |
number of resamplings to obtain the rarefied estimate |
samplesize |
sample size to which the rarefaction procedure is carried out |
This function computes a rarefied estimate of Escoufier RV coefficient as suggested by Fruciano et al 2013 - Plos One This can be useful to compare RV among groups with the same variables but different sample sizes (as RV depends on sample size, see Fruciano et al 2013, where this procedure is described). The idea is the one rarefies the two groups at the same sample size
The function outputs a list with the following elements:
Mean rarefied RV
2.5%, 50% (median) and 97.5% percentiles of the rarefied RV
All RV values obtained using the rarefaction procedure
the function does NOT perform GPA on each rarefied sample this may or may not make a difference in estimates. In many cases, it will probably not make much difference (e.g., Fig. 2 in Fruciano et al 2013)
If you use this function please cite both Fruciano et al. 2013 (for using the rarefaction procedure) and Escoufier 1973 (because the procedure is based on Escoufier RV)
Escoufier Y. 1973. Le Traitement des Variables Vectorielles. Biometrics 29:751-760.
Fruciano C, Franchini P, Meyer A. 2013. Resampling-Based Approaches to Study Variation in Morphological Modularity. PLoS ONE 8:e69376.
EscoufierRV
library(MASS)
set.seed(123)
Pop=mvrnorm(100000,mu=rep(0,100), Sigma=diag(100))
# Create a population of 100,000 'individuals'
# as multivariate normal random data
# We will consider the first 20 columns as the first
# block of variables, and the following one as the second block
A=Pop[1:50,]
B=Pop[501:700,]
# Take two groups (A and B)
# from the same population (there should be no difference
# between them)
EscoufierRV(A[,1:20],A[,21:ncol(A)])
EscoufierRV(B[,1:20],B[,21:ncol(B)])
# Notice how we obtain very different values of Escoufier RV
# (this is because they two groups have very different
# sample sizes, one 50 observations, the other 200)
RarA=RVrarefied(A[,1:20],A[,21:ncol(A)],rep=1000,samplesize=30)
RarB=RVrarefied(B[,1:20],B[,21:ncol(A)],rep=1000,samplesize=30)
RarA$Rarefied_RV
RarB$Rarefied_RV
# Rarefying both groups at the same sample size
# (in this case 30)
# it is clear that the two groups have very similar levels
# of association between blocks
RarA$Quantiles
RarB$Quantiles
# And their intevals clearly overlap
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.