scorestatcorr: Score test statistics in generalized linear models, with...

Description Usage Arguments Value Examples

Description

Computes score test statistics for testing whether each of a large number of coefficients (typically corresponding to genetic markers) in a GLM with canonical link is zero in presence of a smaller number of covariates (typically environmental covariates), and provides estimates of correlations between the test statistics.

Usage

1
scorestatcorr(formula, xg, maxorder, family = gaussian, both = FALSE)

Arguments

formula

Model formula for the null model, i.e. including environmental covariates.

xg

Matrix of genetic markers (one column for each marker).

maxorder

Maximal order of which correlations of score test statistics are estimated.

family

Family of GLM passed to glm.

both

If TRUE, correlations are given both as a list and as a matrix (see 'Value').

Value

A list containing the following components:

statistic

A vector of score test statistics

corrs

A list of vectors of correlations of score test statistics. The first component is a vector of first-order correlations, i.e. between neighbouring markers, the second is a vector of second-order correlations, i.e. between markers of distance 2, etc. The number of components is maxorder. The list is generated if maxorder is greater than 0 and less than the number of columns of xg or if both is TRUE.

corrmatrix

Estimated correlation matrix of the score test statistics. The matrix is generated if maxorder is equal to the number of columns of xg or if both is TRUE. In the latter case, any correlations between markers of distance greater than maxorder will be set to 0. scorestatcorr will attempt to load the Matrix package and return corrmatrix as a sparse banded matrix.

.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Normal model with three environmental covariates:
result <- scorestatcorr(y_normal ~ sex + activity + agecategory, xg, 2)
result$statistic[1:10]
result$corrs[[1]][1:10]
pvals <- 2*pnorm(-abs(result$statistic)) # p-values for two-sided test
pvals[1:10]

# Logistic model without environmental covariates:
resultl <- scorestatcorr(y_logistic ~ 1, xg, 2, family = binomial)
resultl$statistic[1:10]
resultl$corrs[[1]][1:10]
pvalsl <- 2*pnorm(-abs(resultl$statistic))
pvalsl[1:10]

oyvind-bakke/fwerapprox documentation built on May 29, 2019, 7:35 a.m.