| haplo.quant {SimHap} | R Documentation |
haplo.quant performs a series of linear models using a simulation-based approach to account for uncertainty in haplotype assignment when phase is unknown.
haplo.quant(formula1, formula2, pheno, haplo, sim,
effect = "add", sub = NULL, predict_variable = NULL)
formula1 |
a symbolic description of the full model including haplotype parameters to be fit. The details of model specification are given below. |
formula2 |
a symbolic description of the nested model excluding haplotype parameters, to be compared to formula1 in a likelihood ratio test. |
pheno |
a dataframe containing phenotype data. |
haplo |
a haplotype object made by make.haplo.rare. |
sim |
the number of simulations from which to evaluate the results. |
effect |
the haplotypic effect type: "add" for additive, "dom" for dominant and "rec" for recessive. Defaults to additive. See note. |
sub |
optional. An expression representing a subset of individuals on which to perform analysis. e.g. sub=expression(sex==1). |
predict_variable |
an expression using a binary operator, representing a subset of the data on which to perform the models |
formula1 should be in the form of response ~ predictor(s) + haplotype(s) and formula2 should be in the form response ~ predictor(s). A formula has an implied intercept term. See 'formula' for more details of allowed formulae.
haplo.quant returns an object of class hapQuant.
The summary function can be used to obtain and print a
summary of the results.
An object of class hapQuant is a list containing the
following components:
formula1 |
formula1 passed to haplo.quant. |
formula1 |
formula2 passed to haplo.quant. |
results |
a table containing the coefficients, standard errors and p-values of the parameter estimates, averaged over the sim models performed. |
empiricalResults |
a list containing the coefficients, standard errors and p-values calculated at each simulation. |
rsquared |
r-squared values for models fit using formula1 and formula2. |
ANOD |
analysis of deviance table for the model fit using formula1, averaged over all simulations. |
logLik |
the average log-likelihood for the linear model fit using formula1. |
LRT |
a likelihood ratio test, testing for significant improvement of the model when haplotypic parameters are included. |
predicted |
estimated marginal means of the outcome variable broken down by haplotype levels, evaluated at mean values of the model predictors, averaged over all simulations. |
empiricalPredicted |
estimated marginal means calculated at each simulation. |
aic |
Akaike Information Criterion for the linear model fit using formula1, averaged over all simulations. |
aicPredicted |
Akaike Information Criteria calculated at each simulation. |
effect |
the haplotypic effect modelled, `ADDITIVE', `DOMINANT' or `RECESSIVE'. |
To model a codominant haplotypic effect, define the desired haplotype as a factor in the formula1 argument. e.g. factor(h.AAA), and use the default option for effect
Pamela A. McCaskie
Chambers, J.M. (1992) Linear models. Chapter 4 of Statistical Models in S, eds Chambers, J.M., Hastie, T.J., Wadsworth & Brooks/Cole.
Little, R.J.A., Rubin, D.B. (2002) Statistical Analysis with Missing Data. John Wiley and Sons, New Jersey.
McCaskie, P.A., Carter, K.W, Hazelton, M., Palmer, L.J. (2007) SimHap: A comprehensive modeling framework for epidemiological outcomes and a multiple imputation approach to haplotypic analysis of population-based data, [online] www.genepi.org.au/simhap.
Rubin, D.B. (1996) Multiple imputation after 18+ years (with discussion). Journal of the American Statistical Society, 91:473-489.
Wilkinson, G.N., Rogers, C.E. (1973) Symbolic descriptions of factorial models for analysis of variance. Applied Statistics, 22, 392-9.
data(SNP.dat)
# convert SNP.dat to format required by infer.haplos
haplo.dat <- SNP2Haplo(SNP.dat)
data(pheno.dat)
# generate haplotype frequencies and haplotype design matrix
myinfer<-infer.haplos(haplo.dat)
# print haplotype frequencies generated by infer.haplos
myinfer$hap.freq
# generate haplo object where haplotypes with a frequency
# below min.freq are grouped as a category called "rare"
myhaplo<-make.haplo.rare(myinfer,min.freq=0.05)
mymodel <- haplo.quant(formula1=HDL~AGE+SBP+h.N1AA,
formula2=HDL~AGE+SBP, pheno=pheno.dat, haplo=myhaplo, sim=10)
summary(mymodel)
# example using a variable for which to predict marginal means
mymodel <- haplo.quant(formula1=HDL~AGE+SBP+factor(h.N1AA),
formula2=HDL~AGE+SBP, pheno=pheno.dat, haplo=myhaplo, sim=10,
predict_variable="h.N1AA")
summary(mymodel)
# example with a subsetting variable, looking at males only
# and modelling a dominant haplotypic effect
mymodel <- haplo.quant(formula1=HDL~AGE+SBP+h.N1AA, formula2=HDL~AGE+SBP,
pheno=pheno.dat, haplo=myhaplo, sim=10, effect="dom",
sub=expression(SEX==1))