vruvinv: Variance inflated RUV-inverse.

Description Usage Arguments Details Value Author(s) References

View source: R/ruv4.R

Description

RUV-inverse as described in Gagnon-Bartsch et al (2013) is just RUV4 using the maximum number of confounders allowed by the model, followed by estimating the variances using a method-of-moments type approach. vruvinv is similar in spirit to this by using the maximum number of confounders allowed by the model, but we still estimate the variance inflation using the confounders. We force limmashrink = TRUE, otherwise there is only one degree of freedom to estimate the variance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
vruvinv(
  Y,
  X,
  ctl,
  cov_of_interest = ncol(X),
  likelihood = c("t", "normal"),
  include_intercept = TRUE,
  fa_func = pca_naive,
  fa_args = list(),
  adjust_bias = FALSE
)

Arguments

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 ncol(Y). If position i is TRUE then position i is considered a negative control.

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 "normal" or "t". If likelihood = "t", then the user may provide the degrees of freedom via degrees_freedom.

include_intercept

A logical. If TRUE, then it will check X to see if it has an intercept term. If not, then it will add an intercept term. If FALSE, then X will be unchanged.

fa_func

A factor analysis function. The function must have as inputs a numeric matrix Y and a rank (numeric scalar) r. It must output numeric matrices alpha and Z and a numeric vector sig_diag. alpha is the estimate of the coefficients of the unobserved confounders, so it must be an r by ncol(Y) matrix. Z must be an r by nrow(Y) matrix. sig_diag is the estimate of the column-wise variances so it must be of length ncol(Y). The default is the function pca_naive that just uses the first r singular vectors as the estimate of alpha. The estimated variances are just the column-wise mean square.

fa_args

A list. Additional arguments you want to pass to fa_func.

adjust_bias

A logical. Should we also use the control genes to adjust for bias (TRUE) or not (FALSE)

Details

Hence, this is just a wrapper for vruv4, but with a special choice for the number of confounders and forcing limmashrink = TRUE.

Value

See vruv4 for the elements returned.

Author(s)

David Gerard

References


dcgerard/vicar documentation built on July 7, 2021, 1:08 p.m.