Description Usage Arguments Details Value Author(s) References See Also
This function will perform a variant of Removing Unwanted Variation 2-step (RUV2) (Gagnon-Bartsch et al, 2013), where we include a variance inflation parameter in the factor analysis.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Y |
A matrix of numerics. These are the response variables where each column has its own variance. In a gene expression study, the rows are the individuals and the columns are the genes. |
X |
A matrix of numerics. The covariates of interest. |
ctl |
A vector of logicals of length |
k |
A non-negative integer.The number of unobserved confounders. If not specified and the R package sva is installed, then this function will estimate the number of hidden confounders using the methods of Buja and Eyuboglu (1992). |
cov_of_interest |
A vector of positive integers. The column numbers of the covariates in X whose coefficients you are interested in. The rest are considered nuisance parameters and are regressed out by OLS. |
likelihood |
Either |
limmashrink |
A logical. Should we apply hierarchical
shrinkage to the variances ( |
degrees_freedom |
if |
include_intercept |
A logical. If |
gls |
A logical. Should we estimate the part of the
confounders associated with the nuisance parameters with gls
( |
fa_func |
A factor analysis function. It must take parameters:
|
fa_args |
A list. Additional arguments you want to pass to fa_func. |
use_factor |
A logical. Should we use the estimates of
|
force_check |
A logical. Are you REALLY sure you want to use
another fa_func ( |
fa_limmashrink |
A logical. Should we shrink the variances
during the factor analysis step ( |
See vruv4
for a description of the model.
You can provide your own factor analysis, but it must include an estimate for the variance inflation parameter. This turns out to be pretty hard. The way I do it now seems to work OK.
A list whose elements are:
betahat
A matrix of numerics. The ordinary least
squares estimates of the coefficients of the covariate of
interest WHEN YOU ALSO INCLUDE THE ESTIMATES OF THE UNOBSERVED
CONFOUNDERS.
sebetahat
A matrix of positive numerics. This is the
post-inflation adjusted standard errors for ruv$betahat
.
tstats
A vector of numerics. The t-statistics for
testing against the null hypothesis of the coefficient of the
covariate of interest being zero. This is after estimating the
variance inflation parameter.
pvalues
A vector of numerics. The p-values of said test
above.
alphahat
A matrix of numerics. The estimates of the
coefficients of the hidden confounders. Only identified up to a
rotation on the rowspace.
Zhat
A matrix of numerics. The estimates of the
confounding variables. Only identified up to a rotation on the
columnspace.
sigma2
A vector of positive numerics. The estimates of
the variances PRIOR to inflation.
sigma2_adjusted
A vector of positive numerics. The
estimates of the variances AFTER to inflation. This is equal to
sigma2 * multiplier
.
multiplier
A numeric. The estimated variance inflation
parameter.
mult_matrix
A matrix of numerics. Equal to
solve(t(cbind(X, Zhat)) %*% cbind(X, Zhat))
. One
multiplies sigma2
or simga2_adjused
by the
diagonal elements of mult_matrix
to get the standard
errors of betahat
.
degrees_freedom
The degrees of freedom of the t-
statistics.
David Gerard
Buja, A. and Eyuboglu, N., 1992. "Remarks on parallel analysis." Multivariate behavioral research, 27(4), pp.509-540. doi: 10.1207/s15327906mbr2704_2
Gagnon-Bartsch, J., Laurent Jacob, and Terence P. Speed, 2013. "Removing unwanted variation from high dimensional data with negative controls." Berkeley: Department of Statistics. University of California. https://statistics.berkeley.edu/tech-reports/820
Gerard, David, and Matthew Stephens. 2021. "Unifying and Generalizing Methods for Removing Unwanted Variation Based on Negative Controls." Statistica Sinica, 31(3), 1145-1166. doi: 10.5705/ss.202018.0345
pca_2step
for the special factor analysis
that results in variance inflation in RUV2.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.