anova2: Get ANOVA type-II p-values from genetic model

View source: R/anova2.R

anova2R Documentation

Get ANOVA type-II p-values from genetic model

Description

This function assings p-values to a polyygenic linear model. Essentially a wrapper around stats::drop1() to assign p-values to a small number of selected loci while fitting PCs without caring about their significance.

Usage

anova2(X, y, pcs = NULL)

Arguments

X

The genotype matrix. Each row of X receives a p-value. Unlike other functions, where X is expected to be genome-wide, here we don't use penalized models so X must have fewer predictors (loci) than samples (individuals; if this happens a vector of 1s for all locus p-values is returned). These predictiors are expected to have been selected in a previous step by glmnet or another such approach. Row names of X may contain special characters (including math operations, colons, and spaces; names will be quoted in output) except backticks are not allowed and cause an error.

y

The trait vector. It must have length equal to the number of individuals.

pcs

The PC (eigenvector) matrix (optional). It must have individuals along the rows and dimensions along the columns. Unlike X, all of pcs receives a single p-value (even if it contains multiple columns; for computational efficiency, it is assumed that selection or ranking of individual PCs is not of interest).

Value

A data frame containing these columns: 'Df', 'SS', 'RSS', 'AIC', 'F', 'p'. The first row is for the full model, followed by statistics for pcs if present, followed by per-locus statistics for X. If X had row names, these are the names of the variables (row names of this output data frame; possibly quoted with backticks if they had special symbols); otherwise 'x1', 'x2', and so on are used. When there are as many or more predictors (loci) as there are samples (individuals), or if a perfect fit is detected, data returned is a dummy data frame containing only the 'p' column and with all p-values equal to 1.

Examples

## Not run: 
data <- anova2(X, y, pcs)

## End(Not run)


OchoaLab/polygenr documentation built on March 18, 2022, 10:52 a.m.