Learn R Programming

haplo.stats (version 1.9.7)

haplo.design: Build a design matrix for haplotypes

Description

Build a design matrix for haplotypes estimated from a haplo.em object.

Usage

haplo.design(obj, haplo.effect="additive", hapcodes=NA, min.count=5, haplo.base=NA)

Value

Matrix of columns for haplotype effects. Column names are "hap.k" where k is the row number of the unique haplotypes within the haplo.em object's "haplotypes" item.

Arguments

obj

an object created from haplo.em

haplo.effect

The "effect" pattern of haplotypes on the response. This parameter determines the coding for scoring the haplotypes. Valid coding options for heterozygous and homozygous carriers of a haplotype are "additive" (1, 2, respectively), "dominant" (1,1, respectively), and "recessive" (0, 1, respectively).

hapcodes

codes assigned in haplo.em, corresponding to the row numbers in the haplotypes matrix item in obj

min.count

The minimum number of estimated counts of the haplotype in the sample in order for a haplotype to be included in the design matrix.

haplo.base

code for which haplotype will be the reference group, or to be considered the baseline of a model. The code is the row number of the haplotypes matrix in obj. This haplotype is removed from the design matrix.

Details

First a matrix is made for the possible haplotypes for each person, coded for the haplo.effect, weighted by the posterior probability of those possible haplotypes per person, and then collapsed back to a single row per person.

See Also

haplo.em

Examples

Run this code

 ###------------------------------------------------
 ### See the user manual for more complete examples
 ###------------------------------------------------

 data(hla.demo)
 attach(hla.demo)

 geno <- hla.demo[,c(17,18,21:24)]
 label <-c("DQB","DRB","B")

 keep <- !apply(is.na(geno) | geno==0, 1, any)

 save.em.keep <- haplo.em(geno=geno[keep,], locus.label=label)

 save.df <- haplo.design(save.em.keep, min.count=10)
 dim(save.df)

 names(save.df)
 save.df[1:10,]


Run the code above in your browser using DataLab