scan_pvl calculates log likelihood for d-variate phenotype model fits. Inputted parameter start_snp indicates where in the probs object to start the scan.

scan_pvl(probs, pheno, kinship = NULL, addcovar = NULL,
start_snp = 1, n_snp, max_iter = 10000, max_prec = 1/1e+08,
n_cores = 1)

## Arguments

probs an array of founder allele probabilities for a single chromosome a matrix of phenotypes a kinship matrix for one chromosome a matrix, n subjects by c additive covariates index of where to start the scan within probs the number of (consecutive) markers to include in the scan maximum number of iterations for EM algorithm stepwise precision for EM algorithm. EM stops once incremental difference in log likelihood is less than max_prec number of cores to use for calculations

## Value

a tibble with d + 1 columns. First d columns indicate the genetic data (by listing the marker ids) used in the design matrix; last is log likelihood

## Details

The function first discards individuals with one or more missing phenotypes or missing covariates. It then infers variance components, Vg and Ve. Both Vg and Ve are d by d covariance matrices. It uses an expectation maximization algorithm, as implemented in the gemma2 R package. gemma2 R package is an R implementation of the GEMMA algorithm for multivariate variance component estimation (Zhou & Stephens 2014 Nature methods). Note that variance components are fitted on a model that uses the d-variate phenotype but contains no genetic information. This model does, however, use the specified covariates (after dropping dependent columns in the covariates matrix). These inferred covariance matrices, $$\hat{Vg}$$ and $$\hat{Ve}$$, are then used in subsequent model fitting via generalized least squares. Generalized least squares model fitting is applied to every d-tuple of markers within the specified genomic region for scan_pvl. For a single d-tuple of markers, we fit the model: $$vec(Y) = Xvec(B) + vec(G) + vec(E)$$ where $$G \sim MN(0, K, \hat{Vg})$$ and $$E \sim MN(0, I, \hat{Ve})$$ where $$MN$$ denotes the matrix-variate normal distribution with three parameters: mean matrix, covariance among rows, and covariance among columns. $$vec$$ denotes the vectorization operation, ie, stacking by columns. $$K$$ is a kinship matrix, typically calculated by leave-one-chromosome-out methods. $$Y$$ is the n by d phenotypes matrix. $$X$$ is a block-diagonal nd by fd matrix consisting of d blocks each of dimension n by f. Each n by f block (on the diagonal) contains a matrix of founder allele probabilities for the n subjects at a single marker. The off-diagonal blocks have only zero entries. The log-likelihood is returned for each model. The outputted object is a tibble with d + 1 columns. The first d columns specify the markers used in the corresponding model fit, while the last column specifies the log-likelihood value at that d-tuple of markers.

## References

Knott SA, Haley CS (2000) Multitrait least squares for quantitative trait loci detection. Genetics 156: 899–911.

Jiang C, Zeng ZB (1995) Multiple trait analysis of genetic mapping for quantitative trait loci. Genetics 140: 1111-1127.

Zhou X, Stephens M (2014) Efficient multivariate linear mixed model algorithms for genome-wide association studies. Nature methods 11:407-409.

Broman KW, Gatti DM, Simecek P, Furlotte NA, Prins P, Sen S, Yandell BS, Churchill GA (2018) R/qtl2: software for mapping quantitative trait loci with high-dimensional data and multi-parent populations. Biorxiv https://www.biorxiv.org/content/early/2018/09/12/414748.

## Examples

# read data
# insert pseudomarkers into map
map <- qtl2::insert_pseudomarkers(iron$gmap, step=1) # calculate genotype probabilities probs <- qtl2::calc_genoprob(iron, map, error_prob=0.002) # grab phenotypes and covariates; ensure that covariates have names attribute pheno <- iron$pheno
# leave-one-chromosome-out kinship matrices
kinship <- qtl2::calc_kinship(probs, "loco")$1 # get founder allele probabilites probs <- qtl2::genoprob_to_alleleprob(probs)$1
ac <- matrix(as.numeric(iron$covar$sex == "m", ncol = 1))
colnames(ac) <- "sex"
rownames(ac) <- rownames(probs)
scan_pvl(probs = probs, pheno = pheno, kinship = kinship, addcovar = ac,
start_snp = 1, n_snp = 80, n_cores = 1)#> starting covariance matrices estimation with data from 284 subjects.#> covariance matrices estimation completed.#> # A tibble: 6,400 x 3
#>    Var1     Var2    loglik
#>    <chr>    <chr>    <dbl>
#>  1 D1Mit18  D1Mit18 -3230.
#>  2 c1.loc28 D1Mit18 -3230.
#>  3 c1.loc29 D1Mit18 -3230.
#>  4 c1.loc30 D1Mit18 -3230.
#>  5 c1.loc31 D1Mit18 -3230.
#>  6 c1.loc32 D1Mit18 -3230.
#>  7 c1.loc33 D1Mit18 -3230.
#>  8 c1.loc34 D1Mit18 -3230.
#>  9 c1.loc35 D1Mit18 -3230.
#> 10 c1.loc36 D1Mit18 -3230.
#> # … with 6,390 more rows