Learn R Programming

Haplin (version 7.3.2)

haplinStrat: Fit haplin to each subset/stratum of data, determined by the argument strata

Description

Produces a list, each element of which is an object of class haplin, which is the result of fitting the log-linear haplin models to each strata stratum independently.

Usage

haplinStrat( data, strata = NULL, ...)

Value

A list of objects of class haplin is returned. The first element contains the result of running haplin on the entire data file; the remaining elements are the results from each of the strata. The names of the list correspond to the values of the strata variable.

Arguments

data

R-object of class "haplin.ready", which is e.g., output from genDataPreprocess or genDataLoad, and contains covariate and genetic data.

strata

A single integer specifying the number of the column in the covariate data that contains the stratification variable

...

Remaining arguments to be used by haplin in each run.

Author

Hakon K. Gjessing
Professor of Biostatistics
Division of Epidemiology
Norwegian Institute of Public Health
hakon.gjessing@uib.no

Details

haplinStrat runs haplin first on the entire input data file, then on each stratum separately. Strata are defined by the strata variable, which can be coded as numerical or character. However, one should use only a moderate number of levels/strata, since haplin will be run independetly on each, and some strata may otherwise have an insufficient amount of data. Running haplinStrat is thus just a simplification of manually splitting the file into strata and running haplin on each; the end result would be the same. The main reason for running haplinStrat is to test for gene-environment interactions. This is achieved by running postTest on the result from haplinStrat. haplinStrat can also be run from within haplinSlide by using the strata argument in haplinSlide.

References

Gjessing HK and Lie RT. Case-parent triads: Estimating single- and double-dose effects of fetal and maternal disease gene haplotypes. Annals of Human Genetics (2006) 70, pp. 382-396.

Web Site: https://haplin.bitbucket.io

See Also

haplin, summary.haplin, plot.haplin, haptable, toDataFrame, haplinSlide, gxe

Examples

Run this code

# setting up the directory with exemplary data
dir.in <- system.file( "extdata", package = "Haplin" )
file.in <- paste0( dir.in, "/data.dat" )

# reading data in
data.in <- genDataRead( file.in, file.out = "poo_exmpl_data_read", format = "haplin",
  dir.out = tempdir( check = TRUE ), n.vars = 1, allele.sep = " ", col.sep = " ",
  overwrite = TRUE )
# preprocessing the data
data.preproc <- genDataPreprocess( data.in, design = "triad",
  file.out = "poo_exmpl_data_preproc", dir.out = tempdir( check = TRUE ), overwrite = TRUE )

# running haplinStrat, checking for gene-environment interactions
res.GxE <- haplinStrat( data.preproc, markers = 2, strata = 1, poo = FALSE,
  response = "mult", reference = 2, use.missing = TRUE )
res.GxE

# running haplinStrat, checking for POO-environment interactions
res.POOxE <- haplinStrat( data.preproc, markers = c(1,2,3), strata = 1, poo = TRUE,
  response = "mult", reference = "ref.cat", use.missing = TRUE )
res.POOxE

if (FALSE) {
# All standard haplin runs can be done with haplinStrat. 
# Below is an illustration. See the haplin help page for more 
# examples.
# 
# Analyzing the effect of fetal genes, including triads with missing data,
# using a multiplicative response model. The first column of the data file
# in this example contains the stratification variable.
result <- haplinStrat("C:/work/data.dat", strata = 1, use.missing = T, response = "mult",
reference = "ref.cat", winlength = 1)
# Provide summary of separate results:
lapply(result, summary)
# Plot results separately:
par(ask = T)
lapply(result, plot)
#
# Convert results to table format and stack them over strata:
haptable(result)
# Test for interaction between haplotype risk estimates and the strata variable:
postTest(result)




}

Run the code above in your browser using DataLab