hlaAssocTest: Statistical Association Tests

View source: R/Association.R

hlaAssocTestR Documentation

Statistical Association Tests

Description

Perform statistical association tests via Pearson's Chi-squared test, Fisher's exact test and logistic regressions.

Usage

## S3 method for class 'hlaAlleleClass'
hlaAssocTest(hla, formula, data,
    model=c("dominant", "additive", "recessive", "genotype"),
    model.fit=c("glm"), prob.threshold=NaN, use.prob=FALSE, showOR=FALSE,
    verbose=TRUE, ...)
## S3 method for class 'hlaAASeqClass'
hlaAssocTest(hla, formula, data,
    model=c("dominant", "additive", "recessive", "genotype"),
    model.fit=c("glm"), prob.threshold=NaN, use.prob=FALSE, showOR=FALSE,
    show.all=FALSE, verbose=TRUE, ...)

Arguments

hla

an object of hlaAlleleClass

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted, e.g., y ~ 1, y ~ h + a

data

an optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from environment(formula)

model

dominant, additive, recessive or genotype models: "dominant" is default

model.fit

"glm" – generalized linear regression

prob.threshold

the probability threshold to exclude individuals with low confidence scores

use.prob

if TRUE, use the posterior probabilities as weights in glm models

showOR

show odd ratio (OR) instead of log OR if TRUE

show.all

if TRUE, show both significant and non-significant results; if FALSE, only show significant results

verbose

if TRUE, show information

...

optional arguments to glm or nlme call

Details

model description (given a specific HLA allele h)
dominant [-/-] vs. [-/h,h/h] (0 vs. 1 in design matrix)
additive [-] vs. [h] in Chi-squared and Fisher's exact test, the allele dosage in regressions (0: -/-, 1: -/h, 2: h/h)
recessive [-/-,-/h] vs. [h/h] (0 vs. 1 in design matrix)
genotype [-/-], [-/h], [h/h] (0 vs. 1 in design matrix)

In allelic associations, Chi-squared and Fisher exact tests are preformed on the cross tabulation, which is constructed according to the specified model (dominant, additive, recessive and gneotype).

In amino acid associations, Fisher exact test is performed on a cross tabulation with the numbers of each amino acid stratified by response variable (e.g., disease status).

In linear and logistic regressions, 95% confidence intervals are calculated based on asymptotic normality. The option use.prob=TRUE might be useful in the sensitivity analysis.

Value

Return a data.frame with

[-]

the number of haplotypes not carrying the specified HLA allele

[h]

the number of haplotype carrying the specified HLA allele

%.[-], ...

case/disease proportion in the group [-], ...

[-/-]

the number of individuals or haplotypes not carrying the specified HLA allele

[-/h]

the number of individuals or haplotypes carrying one specified HLA allele

[-/h]

the number of individuals or haplotypes carrying two specified HLA alleles

[-/h, h/h]

the number of individuals or haplotypes carrying one or two specified HLA alleles

[-/-, -/h]

the number of individuals or haplotypes carrying at most one specified HLA allele

%.[-/-], ...

case/disease proportion in the group [-/-], ...

avg.[-/-], ...

outcome average in the group [-/-], ...

chisq.st

the value the chi-squared test statistic

chisq.p

the p-value for the Chi-squared test

fisher.p

the p-value for the Fisher's exact test

h.est

the coefficient estimate of HLA allele

h.25%, h.75%

the 95% confidence interval for HLA allele

h.pval

p value for HLA allele

Author(s)

Xiuwen Zheng

See Also

hlaConvSequence, summary.hlaAASeqClass

Examples

hla.id <- "A"
hla <- hlaAllele(HLA_Type_Table$sample.id,
    H1 = HLA_Type_Table[, paste(hla.id, ".1", sep="")],
    H2 = HLA_Type_Table[, paste(hla.id, ".2", sep="")],
    locus=hla.id, assembly="hg19")

set.seed(1000)
n <- nrow(hla$value)
dat <- data.frame(case = c(rep(0, n/2), rep(1, n/2)), y = rnorm(n),
    pc1 = rnorm(n))

hlaAssocTest(hla, case ~ 1, data=dat)
hlaAssocTest(hla, case ~ 1, data=dat, model="additive")
hlaAssocTest(hla, case ~ 1, data=dat, model="recessive")
hlaAssocTest(hla, case ~ 1, data=dat, model="genotype")

hlaAssocTest(hla, y ~ 1, data=dat)
hlaAssocTest(hla, y ~ 1, data=dat, model="genotype")

hlaAssocTest(hla, case ~ h, data=dat)
hlaAssocTest(hla, case ~ h + pc1, data=dat)
hlaAssocTest(hla, case ~ h + pc1, data=dat, showOR=TRUE)

hlaAssocTest(hla, y ~ h, data=dat)
hlaAssocTest(hla, y ~ h + pc1, data=dat)
hlaAssocTest(hla, y ~ h + pc1, data=dat, showOR=TRUE)

hlaAssocTest(hla, case ~ h, data=dat, model="additive")
hlaAssocTest(hla, case ~ h, data=dat, model="recessive")
hlaAssocTest(hla, case ~ h, data=dat, model="genotype")

zhengxwen/HIBAG documentation built on April 16, 2024, 8:41 a.m.