NullObject.parameters {Ravages}R Documentation

Null Model for SKAT and burden tests

Description

Get the parameters under the null model to peforms burden tests or SKAT

Usage

  NullObject.parameters(pheno, RVAT, pheno.type = c("categorical", "continuous"), 
                        ref.level, data, formula)

Arguments

pheno

The phenotype of each individual: a factor if pheno.type = "categorical", and a numeric vector if pheno.type = "continuous"

RVAT

The type of Rare Variant Association Test (RVAT) to perform: should be "burden" or "SKAT"

pheno.type

The type of phenotype: "categorical" for binary or multinomial traits, or "continuous"

ref.level

The reference group of individuals for the regression, only needed if RVAT = "burden" and pheno.type = "categorical"

data

Optional, a matrix containing the covariates with one column per covariate and one row per individual

formula

Optional, an R formula corresponding to the regression model indicating which covariates from data to include in the model if only some of them are to be included

Details

Warning: individuals in pheno and data should be in the same order.

This function gets the parameters under the null model for SKAT or the burden tests.

For burden tests, it computes the Log-Likelihood under the null model used to perform the Likelihood Ratio Test.

For SKAT, it computes the probabilites for each individual of belonging to each group based on the group sizes and the potential covariates.

If formula is missing, all columns from data will be included as covariates.

Value

A list containing different elements depending on the RVAT performed and the pheno.type.

- if RVAT = "burden" and pheno.type = "categorical":

group

A factor containing the group of each individual as given

ref.level

The reference group of individuals for the regression as given

H0.LogLik

The Log-Likelihood of the null model

covar.toinclude

Which covariates to include in the regression, depends on the argument formula

data

The data argument containing covariates, NULL if it was missing

- if RVAT = "burden" and pheno.type = "continuous":

pheno

A numeric vector containing the phenotype value for each individual as given

covar.toinclude

Which covariates to include in the regression, depends on the argument formula

data

The data argument containing covariates, NULL if it was missing

- if RVAT = "SKAT" and pheno.type = "categorical":

Pi.data

A matrix n.individuals x n.groups containing the probabilities that each individual belong to each group

X

A matrix containing 1 in the first column for the intercept, and covariates from data and formula

group

A factor containing the group of each individual as given

get.moments

How to compute moments based on sample size for p-value calculations (only used if get.moments = "size.based" for a categorical phenotype in SKAT.

P1

The vairance-covariance matrix of (Y - Pi_hat)

- if RVAT = "SKAT" and pheno.type = "continuous":

ymp

A matrix n.individuals x 1 containing the (y - pi_hat) values, i.e. the residuals from the regression of the phenotype on the potential covariates

X

A matrix containing 1 in the first column for the intercept, and covariates from data and formula

pheno

The phenotype of each individual as given

P1

The variance matrix of ymp

See Also

SKAT, burden

Examples

#Random phenotype of 100 individuals 
random.multi.pheno <- sample(1:3, 100, replace = TRUE)
#Random continuous phenotype
random.continuous.pheno <- rnorm(100)
#Random sex covariate
random.covar <- matrix( sample(1:2, prob = c(0.4, 0.6), size = 100, replace = TRUE),
                        ncol = 1 )

#Null Model for burden with a multinomi-category phenotype
#Controls as reference group, no covariates
H0.burden.multi <- NullObject.parameters(pheno = as.factor(random.multi.pheno), 
                                         RVAT = "burden", pheno.type = "categorical", ref.level = 1)
#Null Model for SKAT with a continuous phenotype and a covariate
H0.SKAT.continuous <- NullObject.parameters(pheno = random.continuous.pheno,
                                            RVAT = "SKAT", pheno.type = "continuous",
                                            data = random.covar)

[Package Ravages version 1.1.3 Index]