rotate_model: QR rotation to independent models.

Description Usage Arguments Value Author(s)

View source: R/ruv4.R

Description

QR rotation to independent models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
rotate_model(
  Y,
  X,
  k,
  cov_of_interest = ncol(X),
  include_intercept = TRUE,
  limmashrink = FALSE,
  fa_func = pca_naive,
  fa_args = list(),
  do_factor = TRUE
)

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.

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.

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.

limmashrink

A logical. Should we apply hierarchical shrinkage to the variances (TRUE) or not (FALSE)? If degrees_freedom = NULL and limmashrink = TRUE and likelihood = "t", then we'll also use the limma returned degrees of freedom.

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.

do_factor

A logical. Should we do the factor analysis or just rotation?

Value

A list that contains some of the following elements.

Author(s)

David Gerard


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