API

MultiResponseVarianceComponentModels.MRTVCModelMethod
MRTVCModel(
    Y::AbstractVecOrMat,
    X::Union{Nothing, AbstractVecOrMat},
    V::Vector{<:AbstractMatrix}
    )

Create a new MRTVCModel instance from response matrix Y, predictor matrix X, and kernel matrices V. The number of variance components must be two.

Keyword arguments

se::Bool        calculate standard errors; default true
reml::Bool      pursue REML estimation instead of ML estimation; default false
source
MultiResponseVarianceComponentModels.MRVCModelMethod
MRVCModel(
    Y::AbstractVecOrMat,
    X::Union{Nothing, AbstractVecOrMat},
    V::Union{AbstractMatrix, Vector{<:AbstractMatrix}}
    )

Create a new MRVCModel instance from response matrix Y, predictor matrix X, and kernel matrices V.

Keyword arguments

se::Bool        calculate standard errors; default true
reml::Bool      pursue REML estimation instead of ML estimation; default false

Extended help

When there are two variance components, computation can be reduced by avoiding large matrix inversion per iteration, which is achieved with MRTVCModel instance. MRTVCModels stands for Multivariate Response Two Variance Components linear mixed Models. MRVCModel is more general and is not limited to two variance components case. For MRTVCModel, the number of variance components must be two.

source
MultiResponseVarianceComponentModels.fisher_B!Method
fisher_B!(model::MRVCModel)

Compute the sampling variance-covariance model.Bcov of regression coefficients model.B, assuming inverse of covariance matrix model.Ω is available at model.storage_nd_nd.

source
MultiResponseVarianceComponentModels.fisher_Σ!Method
fisher_Σ!(model::MRVCModel)

Compute the sampling variance-covariance model.Σcov of variance component estimates model.Σ, assuming inverse of covariance matrix model.Ω is available at model.storage_nd_nd.

source
MultiResponseVarianceComponentModels.fit!Method
fit!(model::MRVCModel)
fit!(model::MRTVCModel)

Fit a multivariate response variance components model by MM or EM algorithm.

Keyword arguments

maxiter::Int        maximum number of iterations; default 1000
reltol::Real        relative tolerance for convergence; default 1e-6
verbose::Bool       display algorithmic information; default true
init::Symbol        initialization strategy; :default initializes by least squares, while
    :user uses user-supplied values at model.B and model.Σ
algo::Symbol        optimization algorithm; :MM (default) or :EM (for MRVCModel)
log::Bool           record iterate history or not; default false

Extended help

MM algorithm is provably faster than EM algorithm in this setting, so recommend trying MM algorithm first, which is by default, and switching to EM algorithm if there are convergence issues.

source
MultiResponseVarianceComponentModels.h2Method
h2(model::MRVCModel)

Calculate heritability estimates and their standard errors, assuming that all variance components capture genetic effects except the last term. Also return total heritability from sum of individual contributions and its standard error.

source
MultiResponseVarianceComponentModels.loglikelihood!Method
loglikelihood!(model::MRVCModel)

Overwrite model.storage_nd_nd by inverse of the covariance matrix model.Ω, overwrite model.storage_nd by U' \ vec(model.R), and return the log-likelihood. Assume model.Ω and model.R are already updated according to model.Σ and model.B.

source
MultiResponseVarianceComponentModels.loglikelihood_miss!Method
loglikelihood_miss!(model::MRVCModel)

Overwrite model.storage_nd_nd by inverse of the covariance matrix model.Ω, overwrite model.storage_nd by U' \ vec(model.R), overwrite model.storage_n_miss_n_miss_1 by conditional variance, precompute model.storage_n_miss_n_obs_1 for conditional mean, and return the value of surrogate Q-function of log-likelihood. Assume model.Ω and model.R are already updated according to model.Σ and model.B.

source
MultiResponseVarianceComponentModels.lrtMethod
lrt(model1::MRVCModel, model0::MRVCModel)

Perform a variation of the likelihood ratio test for univariate variance components models as in Molenberghs and Verbeke 2007 with model1 and model0 being the full and nested models, respectively.

source
MultiResponseVarianceComponentModels.permuteMethod
permute(Y::AbstractVecOrMat)

Return permutation P such that vec(Y)[P] rearranges vec(Y) with missing values spliced after non-missing values. Also return inverse permutation invP such that vec(Y)[P][invP] = vec(Y).

source
MultiResponseVarianceComponentModels.update_B_miss!Method
update_B_miss!(model::MRVCModel)

Update the regression coefficients model.B, assuming inverse of covariance matrix model.Ω is available at model.storage_nd_nd and model.storage_n_miss_n_obs_1 for conditional mean is precomputed.

source
MultiResponseVarianceComponentModels.update_Γk!Method
update_Γk!(model, k)

Update the parameters model.Γ[k] and model.Ψ[:,k] assuming a diagonal plus low rank structure for model.Σ[k]. Assumes covariance matrix model.Ω is available at model.storage_nd_nd and model.Ω⁻¹R precomputed.

source
MultiResponseVarianceComponentModels.update_Σ!Method
update_Σ!(model::MRVCModel)

Update the variance component parameters model.Σ, assuming inverse of covariance matrix model.Ω is available at model.storage_nd_nd. If missing response, assume conditional variance model.storage_n_miss_n_miss_1 is precomputed.

source
MultiResponseVarianceComponentModels.update_Σk!Method
update_Σk!(model::MRVCModel, k, Val(:EM))

EM update the model.Σ[k] assuming it has full rank d, inverse of covariance matrix model.Ω is available at model.storage_nd_nd, and model.Ω⁻¹R is precomputed.

source
MultiResponseVarianceComponentModels.update_Σk!Method
update_Σk!(model::MRVCModel, k, Val(:MM))

MM update the model.Σ[k] assuming it has full rank d, inverse of covariance matrix model.Ω is available at model.storage_nd_nd, and model.Ω⁻¹R is precomputed.

source
MultiResponseVarianceComponentModels.update_Σk_miss!Method
update_Σk_miss!(model::MRVCModel, k, Val(:MM))

MM update the model.Σ[k] assuming it has full rank d, inverse of covariance matrix model.Ω is available at model.storage_nd_nd, model.Ω⁻¹R is precomputed, and Ω⁻¹P'CPΩ⁻¹ is available at model.storage_nd_nd_miss.

source