htr: Haplotype Trend Regression

View source: R/htr.R

htrR Documentation

Haplotype Trend Regression

Description

Haplotype Trend Regression

Usage

htr(y, x, n.sim = 0L)

Arguments

y

Numeric phenotype vector.

x

Haplotype dosage matrix.

n.sim

Number of permutations (default 0).

Details

Performs haplotype trend regression (HTR) with optional permutation testing. The method follows \insertCitezaykin02;textualgap.

The model fits a linear regression of phenotype on haplotype dosage indicators and computes:

  • Overall F statistic for joint haplotype effects

  • Individual haplotype F statistics

  • Optional permutation-based p-values for both

Permutation p-values are computed using (b + 1) / (B + 1) to avoid zero-valued estimates.

Value

A list with the following components:

f Overall F statistic for global haplotype association.

p P-value for the overall test (asymptotic or permutation-based).

fv Vector of F statistics for individual haplotypes.

pi Vector of p-values for individual haplotypes.

References

\insertRef

zaykin02gap

\insertRef

xie05gap

Examples

## Not run: 
## 26-10-2003
## This example is now part of the demo.
if (!requireNamespace("gap.examples", quietly = TRUE))
    remotes::install_github("jinghuazhao/R/gap.examples")

filespec <- file.path(
    find.package("gap.examples"),
    "tests", "htr", "test2.dat"
)
test2 <- read.table(filespec)
y <- test2[, 1]
x <- test2[, -1]
y <- as.matrix(y)
x <- as.matrix(x)
htr.test2 <- htr(y, x)
htr.test2
htr.test2 <- htr(y, x, n.sim = 10)
htr.test2

## 13-11-2003
library(gap.datasets)
data(apoeapoc)

apoeapoc.gc <- gc.em(apoeapoc[, 5:8])
y <- apoeapoc$y
y[y == 2] <- 1

htr(y, apoeapoc.gc$htrtable)

## 20-08-2008
## Part of the useR! 2008 tutorial by Andrea Foulkes.
## The approach may be used beyond the generalized linear
## model (GLM) framework.
HaploEM <- haplo.em(Geno, locus.label = SNPnames)
HapMat <- HapDesign(HaploEM)

m1 <- lm(Trait ~ HapMat)
m2 <- lm(Trait ~ 1)

anova(m2, m1)

## End(Not run)


gap documentation built on Oct. 27, 2026, 1:07 a.m.