computePCEV: Principal Component of Explained Variance

Description Usage Arguments Details Value See Also Examples

View source: R/main.R

Description

computePCEV computes the first PCEV and tests its significance.

Usage

1
2
3
4
computePCEV(response, covariate, confounder, estimation = c("all",
  "block", "singular"), inference = c("exact", "permutation"),
  index = "adaptive", shrink = FALSE, nperm = 1000,
  na_action = "fail", Wilks = FALSE)

Arguments

response

A matrix of response variables.

covariate

An array or a data frame of covariates.

confounder

An array or data frame of confounders.

estimation

Character string specifying which estimation method to use: "all", "block" or "singular". Default value is "all".

inference

Character string specifying which inference method to use: "exact" or "permutation". Default value is "exact".

index

Only used if estimation = "block". Default value is "adapative". See details.

shrink

Should we use a shrinkage estimate of the residual variance? Default value is FALSE.

nperm

The number of permutations to perform if inference = "permutation" or for the Tracy-Widom empirical estimate (if estimation = "singular").

na_action

how NAs are treated. The default is to raise an error. See details.

Wilks

Should we use a Wilks test instead of Roy's largest test? This is only implemented for a single covariate and with estimation = "all".

Details

This is the main function. It computes the PCEV using either the classical method, block approach or singular. A p-value is also computed, testing the significance of the PCEV.

The p-value is computed using either a permutation approach or an exact test. The implemented exact tests use Wilks' Lambda (only for a single covariate) or Roy's Largest Root. The latter uses Johnstone's approximation to the null distribution. Note that for the block approach, only p-values obtained from a permutation procedure are available.

When estimation = "singular", the p-value is computed using a heuristic: using the method of moments and a small number of permutations (i.e. 25), a location-scale family of the Tracy-Widom distribution of order 1 is fitted to the null distribution. This fitted distribution is then used to compute p-values.

When estimation = "block", there are three different ways of specifying the blocks: 1) if index is a vector of the same length as the number of columns in response, then it is used to match each response to a block. 2) If index is a single positive integer, it is understood as the number of blocks, and each response is matched to a block randomly. 3) If index = "adaptive" (the default), the number of blocks is chosen so that there are about n/2 responses per block, and each response is match to a block randomly. All other values of index should result in an error.

By default, missing values are not allowed. This can be relaxed with na_action. If na_action = "omit", then all rows with at least one missing value will be removed from response before computation. If na_action = "column", then the estimation of the linear model parameters is done column-wise with the non-missing value. This approach maximises the information. Note that missing values are still not allowed in covariate and confounder.

Value

An object of class Pcev containing the first PCEV, the p-value, the estimate of the shrinkage factor, etc.

See Also

estimatePcev

Examples

1
2
3
4
5
set.seed(12345)
Y <- matrix(rnorm(100*20), nrow=100)
X <- rnorm(100)
pcev_out <- computePCEV(Y, X)
pcev_out2 <- computePCEV(Y, X, shrink = TRUE)

GreenwoodLab/pcev documentation built on May 6, 2019, 6:35 p.m.