Description Usage Arguments Details Value Examples
lmmatrix
tests association between independent variables and dependent
variables through simple linear regression (with 1 predictor variable)
1 | lmmatrix(dep, ind, metric = "Rsquared")
|
dep |
n x d matrix or dataframe of dependent variables, where the variables are arranged in columns, and samples or observations in rows. |
ind |
n x i matrix or dataframe of independent variables, where the variables are arranged in columns, and samples or observations in rows. |
metric |
Determines what is returned from the linear models. 'Rsquared' returns the proportion of variance explained, and 'Pvalue' returns the p-value. |
Each independent variable is tested for their association with each dependent variable in simple linear regression (ind ~ dep), and a pvalue or rsquared is extracted and returned as a matrix. broom::glance() is used to calculate p value for the whole model.
A i x d matrix of pvalues or rsquared values.
1 2 3 4 5 6 7 8 9 10 11 12 | ## to calculate PC association with covariates
library(minfiData)
data(RGsetEx)
betas <- na.omit(getBeta(RGsetEx))
pDat <- as.data.frame(pData(RGsetEx))
pc_obj <- prcomp(t(betas))
pc_matrix <- pc_obj$x
cov <- pDat[,c('Sample_Group', 'age', 'sex')]
lmmatrix(dep = pc_matrix, ind = cov)
lmmatrix(dep = pc_matrix, ind = cov, metric = 'Pvalue')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.