inlaAM: Animal model

View source: R/quantgen.R

inlaAMR Documentation

Animal model

Description

Given I genotypes, Q covariates and N=I*Q phenotypes for the trait, fit an "animal model" with the INLA package via the following likelihood: y = W c + Z g_A + Z g_D + epsilon, where y is Nx1; W is NxQ; Z is NxI; g_A ~ Normal_I(0, sigma_A^2 A) with A the known matrix of additive genetic relationships; g_D ~ Normal_I(0, sigma_D^2 D) with D the known matrix of dominant genetic relationships; epsilon ~ Normal_N(0, sigma^2 Id_N); Cov(g_A,g_D)=0; Cov(g_A,e)=0; Cov(g_D,e)=0.

Usage

inlaAM(
  data,
  relmat,
  family = "gaussian",
  nb.threads = 1,
  verbose = 0,
  silent = TRUE
)

Arguments

data

data.frame containing the data corresponding to relmat; should have a column grep-able for "response" as well as a column "geno.add" used with matrix A; if a column "geno.dom" exists, it will be used with matrix D; any other column will be interpreted as corresponding to "fixed effects"

relmat

list containing the matrices of genetic relationships (see estimGenRel); additive relationships (matrix A) are compulsory, with name "geno.add"; dominant relationships (matrix D) are optional, with name "geno.dom"; can be in the "matrix" class (base) or the "dsCMatrix" class (Matrix package)

family

a string indicating the likelihood family (see inla)

nb.threads

maximum number of threads the inla-program will use (see inla)

verbose

verbosity level (0/1/2)

silent

if equal to TRUE, then the inla-program would be silent (see inla)

Value

inla object

Author(s)

Timothee Flutre

See Also

lmerAM, jagsAM, stanAM

Examples

## Not run: ## simulate genotypes
set.seed(1859)
X <- simulGenosDose(nb.genos=200, nb.snps=2000)

## simulate phenotypes with only additive part of genotypic values
A <- estimGenRel(X, relationships="additive", method="vanraden1", verbose=0)
modelA <- simulAnimalModel(T=1, Q=3, A=A, V.G.A=15, V.E=5, seed=1859)

## infer with INLA
library(INLA)
modelA$data$geno.add <- modelA$data$geno
modelA$data$geno <- NULL
fitA <- inlaAM(data=modelA$data, relmat=list(geno.add=A), verbose=1)
summary(fitA)
c(modelA$C); 1/modelA$V.E; 1/modelA$V.G.A

## simulate phenotypes with additive and dominant parts of genotypic values
D <- estimGenRel(X, relationships="dominant", method="vitezica", verbose=0)
modelAD <- simulAnimalModel(T=1, Q=3, A=A, V.G.A=15, V.E=5,
                            D=D, V.G.D=3, seed=1859)

## infer with INLA
modelAD$data$geno.add <- modelAD$data$geno
modelAD$data$geno.dom <- modelAD$data$geno
modelAD$data$geno <- NULL
fitAD <- inlaAM(data=modelAD$data, relmat=list(geno.add=A, geno.dom=D),
                verbose=1)
summary(fitAD)
c(modelAD$C); 1/modelAD$V.E; 1/modelAD$V.G.A; 1/modelAD$V.G.D

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.