Learn R Programming

hapassoc (version 0.1)

EM: Use the EM algorithm to fit maximum likelihood estimates of trait associations with SNP haplotypes

Description

This function takes a data set of haplotypes in which rows for individuals of uncertain phase have been augmented by "pseudo-individuals" carrying consistent multilocus genotypes. The function uses the EM algorithm to find MLE's for trait associations with covariates in generalized linear models.

Usage

EM(form,haplos.list,baseline = "missing" ,family = binomial(),
gamma = FALSE, maxit = 50, tol = 0.001, ...)

Arguments

form
model equation in usual R format
haplos.list
list of haplotype data from CheckHaplos
baseline
optional, haplotype to be used for baseline coding. Default is the most frequent haplotype.
family
binomial, poisson, gaussian or gamma are supported, default=binomial
gamma
initial values for haplotype frequencies, default values are calculated in CheckHaplos using the standard haplotype-counting EM algorithm without adjustment for non-haplotype covariates
maxit
maximum iterations of the EM loop, default=50
tol
convergence tolerance in terms of the maximum difference in parameter estimates between interations; default=0.001
...
additional arguments to be passed to the glm function such as starting values

Value

  • itnumber of iterations
  • betaestimated regression coefficients
  • gammaestimated haplotype frequencies
  • fitsfitted values of the trait
  • wtsfinal weights calculated in last iteration of the EM loop. These are estimates of the conditional probabilities of each multilocus genotype given the observed single-locus genotypes.
  • varjoint variance-covariance matrix of the estimated regression coefficients and the estimated haplotype frequencies
  • dispersionMLmaximum likelihood estimate of dispersion parameter
  • familyfamily of the generalized linear model fit (e.g. binomial, gaussian, etc.)
  • responsetrait value

See Also

RecodeHaplos,CheckHaplos,summary.EM,glm,family.

Examples

Run this code
data(hypoDat)
example.haplos<-RecodeHaplos(hypoDat,2)
example.newhaplos<-CheckHaplos(example.haplos, 2)

# Logistic regression, baseline group: '10/10'

example.regr <- EM(affected ~ gender + age + BMI + n00+ n01 + n11,
                     example.newhaplos, family=binomial())

Run the code above in your browser using DataLab