run.diploffect.inla: Run Diploffect model on diplotype (haplotype pair)...

View source: R/run.diploffect.inla.R

run.diploffect.inlaR Documentation

Run Diploffect model on diplotype (haplotype pair) probabilities

Description

This function primarily takes a formula, data frame, and the diplotype probability matrix for a locus and runs the corresponding Diploffect model for a given number of samples.

Usage

run.diploffect.inla(
  formula,
  data,
  K = NULL,
  num.founders = 8,
  prob.matrix,
  add.only = FALSE,
  num.draws,
  use.dip.lincomb = TRUE,
  seed = 1,
  gamma.rate = 1,
  impute.on = "SUBJECT.NAME",
  weights.on = NULL,
  scale.response = TRUE,
  founders = NULL,
  locus.name = NULL,
  return.joint.posterior.samples = FALSE
)

Arguments

formula

An lm style formula with functions of outcome and covariates in data frame.

data

A data frame with outcome and potential covariates. Should also have individual IDs that link to IDs in the diplotype probability matrix, commonly with this column named "SUBJECT.NAME".

K

A positive semi-definite relationship matrix, usually a realized genetic relationship matrix (GRM) based on SNP genotypes are the haplotype probabilistic reconstructions. Colnames and rownames should match the SUBJECT.NAME column in the data frame.

num.founders

DEFAULT: 8. Number of haplotype alleles. For Collaborative Cross (CC) derived populations, this is 8.

prob.matrix

An n \times num.founders + {num.founders \choose 2} matrix of diplotype probabilities. Rownames should match IDs in K and data.

add.only

DEFAULT: FALSE. Allows only additive haplotype effects to be included in the model.

num.draws

The number of times the diplotype (haplotype pair) probabilities are sampled, and INLA is run.

use.dip.lincomb

DEFAULT: TRUE. Diploffect is parameterized based on additive haplotype effects and heterozygous diplotype dominance effects. If posteriors on diplotypes are wanted, this option is required. It does add to the computation time.

seed

DEFAULT: 1. Diploffect involves a sampling process of the diplotypes, thus a seed is necessary to produce the same results over multiple runs and different machines.

gamma.rate

DEFAULT: 1. Hyper parameter for the variance component priors.

impute.on

DEFAULT: "SUBJECT.NAME". Samples of diplotypes are drawn for each level of this variable. Must be a column in the data frame. Allows the same diplotypes to be sampled if there are repeat observations of a genome, such as in CC or CC-RIX.

weights.on

DEFAULT: NULL. If numeric column in data frame is specified, weights are applied to the diagonal of the random noise (diagonal) covariance matrix. This is an efficient approach to modeling repeat observations, such as in CC or CC-RIX.

scale.response

DEFAULT: TRUE. It is good to scale the response with INLA, thus the posteriors of effects have a consistent scale (in standard deviations of the outcome).

founders

DEFAULT: NULL. Provide alternative labels for the founder alleles. Defaults to the colnames of prob.matrix.

locus.name

DEFAULT: NULL. Provide a locus label.

Value

Diploffect.INLA object. Approximate posterior distributions for model parameters.

Examples

library(Diploffect.INLA)
data(exampleCC)
data(locusmatrix)
inla.diploffect <- run.diploffect.inla(formula=y~1+(1|strain)+(1|dose.date), add.on=FALSE, data=exampleCC, K=NULL,
                                       prob.matrix=locusmatrix,
                                       num.draws=10, 
                                       use.dip.lincomb=TRUE, seed=1, gamma.rate=1, impute.on="CCline")

gkeele/Diploffect.INLA documentation built on May 17, 2023, 8:37 a.m.