fit1_pvl: Fit a model for a specified d-tuple of markers

Description Usage Arguments Value Examples

View source: R/fit1_pvl.R

Description

'fit1_pvl' uses several functions in the package qtl2pleio to fit the linear mixed effects model for a single d-tuple of markers. Creation of 'fit1_pvl' - from code that originally resided in 'scan_pvl', enabled parallelization via the 'parallel' R package.

Usage

1
fit1_pvl(indices, start_snp, probs, addcovar, inv_S, S, pheno)

Arguments

indices

a vector of indices for extracting elements of 'probs' array

start_snp

an integer to specify the index of the marker where the scan - in call to scan_pvl - starts. This argument is needed because 'mytab' has only relative indices (relative to the 'start_snp' marker)

probs

founder allele probabilities array

addcovar

additive covariates matrix

inv_S

inverse covariance matrix for the vectorized phenotype

S

covariance matrix for the vectorized phenotype, ie, the inverse of inv_S. By making this a function input, we avoid inverting the matrix many many times.

pheno

a n by d phenotypes matrix

Value

a number, the log-likelihood for the specified model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
n <- 50
pheno <- matrix(rnorm(2 * n), ncol = 2)
Vg <- diag(2)
Ve <- diag(2)
Sigma <- calc_Sigma(Vg, Ve, diag(n))
Sigma_inv <- solve(Sigma)
probs <- array(dim = c(n, 2, 5))
probs[ , 1, ] <- rbinom(n * 5, size = 1, prob = 0.2)
probs[ , 2, ] <- 1 - probs[ , 1, ]
mytab <- prep_mytab(d_size = 2, n_snp = 5)
fit1_pvl(mytab[1, ], start_snp = 1,
probs = probs, addcovar = NULL, inv_S = Sigma_inv,
S = Sigma,
pheno = pheno
)

qtl2pleio documentation built on Dec. 3, 2020, 1:06 a.m.