leveneTests_per_SNP {gJLS2} | R Documentation |
Levene's test for variance homogeneity by SNP genotypes (sex-specific p-values)
Description
This function takes as input the genotype of a SNP (geno_one
), the genetic sex (SEX
), a quantitative trait (Y
) in a sample population. The function then returns the variance heterogeneity p-values for each sex and the overall variance heterogeneity signal using Fisher's method by combining the sex-specific results.
Usage
leveneTests_per_SNP(
geno_one,
SEX = NULL,
Y,
centre = "median",
transformed = TRUE
)
Arguments
geno_one |
the genotype of a bi-allelic SNP, must be a vector of 0, 1, 2's coded for the number of reference allele. Alternatively, for imputed genotypes, it could be a matrix/vector of dosage values, numerically between 0 and 2. The length/dimension of |
SEX |
optional: the genetic sex of individuals in the sample population, must be a vector of 1 and 2 following the default sex code is 1 for males and 2 for females in PLINK. |
Y |
a vector of quantitative traits, such as human height. |
centre |
a character indicating whether the absolute deviation should be calculated with respect to "median" or "mean", the default option is "median". |
transformed |
a logical indicating whether the quantitative response |
Value
a vector of Levene's test p-values according to levels specified by geno_one
in each sex and the Fisher's method to combine the sex-specific Levene's test p-values.
Note
We recommend to quantile-normally transform Y
to avoid ‘scale-effect’ where
the variance values tend to be proportional to mean values when stratified by G
.
Author(s)
Wei Q. Deng deng@utstat.toronto.edu, Lei Sun sun@utstat.toronto.edu
References
Levene H. (1960) Robust tests for equality of variances. In Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling eds:I. Olkin, S.G. Ghurye, W. Hoeffding, W.G. Madow & H.B.Mann, pp.278-292. Stanford: Stanford University Press.
Examples
N <- 5000
sex <- rbinom(N, 1, 0.5)+1
genDAT <- rbinom(N, 2, 0.3)
y <- rnorm(N);
genDAT[sex==2] <- rbinom(sum(sex==2), 1, 0.3)
table(genDAT, sex)
leveneTests_per_SNP(geno_one=genDAT, SEX=sex, Y=y^2, transform=TRUE)
genDAT[sex==2] <- rbinom(sum(sex==2), 1, 0.01)
table(genDAT, sex)
leveneTests_per_SNP(geno_one=genDAT, SEX=sex, Y=y^2, transform=FALSE)
leveneTests_per_SNP(geno_one=rep(0, N), SEX=sex, Y=y^2, transform=TRUE)
leveneTests_per_SNP(geno_one=rep(0, N), Y=y^2, transform=TRUE)