Description Usage Arguments Details Value Author(s) See Also Examples
This function returns significance values for the association between each column of the response matrix, Y, and the explanatory variables, X, including correction for unobserved confounders (latent factors). The test is based on an LFMM fitted with a ridge or lasso penalty and a generalized linear model.
1 2 |
Y |
a response variable matrix with n rows and p columns. Each column is a response variable (numeric). |
X |
an explanatory variable matrix with n rows and d columns. Each column corresponds to an explanatory variable (numeric). |
lfmm.obj |
an object of class |
calibrate |
a character string, "gif". If the "gif" option is set (default), significance values are calibrated by using the genomic control method. Genomic control uses a robust estimate of the variance of z-scores called "genomic inflation factor". |
The response variable matrix Y and the explanatory variable are centered.
a list with the following attributes:
B the effect size matrix with dimensions p x d.
score a p x d matrix which contains z-scores for each explanatory variable (columns of X),
pvalue a p x d matrix which contains p-values for each explanatory variable,
calibrated.pvalue a p x d matrix which contains calibrated p-values for each explanatory variable,
gif a numeric value for the genomic inflation factor.
cayek, francoio
lfmm_test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | library(lfmm)
## An EWAS example with Y = methylation data
## and X = "exposure" (categorical variable)
data("skin.exposure")
Y <- skin.exposure$beta.value
Y[Y == 0] <- 0.0001 #avoid NA
Y[Y == 1] <- 0.9999
Y <- qnorm(as.matrix(Y))
X <- skin.exposure$exposure == "exposure: sun exposed"
## Fit an LFMM with 2 latent factors
mod.lfmm <- lfmm_ridge(Y = Y,
X = X,
K = 2)
## Perform association testing using the fitted model:
pv <- glm_test(Y = pnorm(Y),
X = X,
lfmm.obj = mod.lfmm,
family = binomial(link = "probit"),
calibrate = "gif")
## Manhattan plot with true associations shown
pvalues <- pv$calibrated.pvalue
plot(-log10(pvalues),
pch = 19,
cex = .3,
xlab = "Probe",
col = "grey")
causal.set <- seq(11, 1496, by = 80)
points(causal.set,
-log10(pvalues)[causal.set],
col = "blue")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.