compute.r2: R2 computation

Description Usage Arguments Details Value References Examples

View source: R/compute.r2.R

Description

Calculates the R2 of a cluster of SNPs.

Usage

1
compute.r2(x, y, res.multisplit, covar = NULL, SNP_index = NULL)

Arguments

x

The input matrix, of dimension nobs x nvar. Each row represents a subject, each column a SNP.

y

The response vector. It can be continuous or discrete.

res.multisplit

The output of multisplit.

covar

NULL or the matrix of covariates one wishes to control for, of size nobs x ncovar.

SNP_index

NULL or the index vector of the cluster of SNPs whose R2 will be computed. See the 'Details' section.

Details

The R2 of a cluster of SNPs is computed on the second half-samples. The cluster members, are intersected with the SNPs selected by the lasso, and the R2 of this model is calculated. Thus, we obtain B R2 values. Finally, the mean of these values is taken. If the value of SNP_index is NULL, the R2 of the full model with all the SNPs will be computed.

Value

The R2 value of the SNP cluster

References

Buzdugan, L. et al. (2015), Assessing statistical significance in predictive genome-wide association studies. (unpublished)

Examples

1
2
3
4
5
6
7
8
library(MASS)
x <- mvrnorm(60,mu = rep(0,60), Sigma = diag(60))
beta <- rep(0,60)
beta[c(5,9,3)] <- 1
y <- x %*% beta + rnorm(60)
SNP_index <- c(5,9,3)
res.multisplit <- multisplit(x, y)
r2 <- compute.r2(x, y, res.multisplit, SNP_index = SNP_index)

Example output



hierGWAS documentation built on Nov. 8, 2020, 8:05 p.m.