Skip to content

Hua-Zhou/MultiResponseVarianceComponentModels.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MultiResponseVarianceComponentModels

Latest Stable Code Style: Blue License CI Codecov Repo Size Aqua QA

MultiResponseVarianceComponentModels.jl is a Julia package that allows fitting and testing multivariate response variance components linear mixed models of form

Installation

julia> ]
pkg> add https://github.com/Hua-Zhou/MultiResponseVarianceComponentModels.jl.git

Documentation

Latest

Examples

using MultiResponseVarianceComponentModels, LinearAlgebra, Random

# simulation
begin
    Random.seed!(1234)
    n = 1_000  # number of observations
    d = 4      # number of responses
    p = 10     # number of covariates
    m = 3      # number of variance components
    X = rand(n, p)
    B = rand(p, d) # fixed effects
    V = [zeros(n, n) for _ in 1:m] # kernel matrices
    Σ = [zeros(d, d) for _ in 1:m] # variance components
    Ω = zeros(n * d, n * d) # overall nd-by-nd covariance matrix Ω
    for i in 1:m
        Vi = randn(n, n)
        mul!(V[i], transpose(Vi), Vi)
        Σi = randn(d, d)
        mul!(Σ[i], transpose(Σi), Σi)
        kron_axpy!(Σ[i], V[i], Ω) # Ω = Σ[1]⊗V[1] + ... + Σ[m]⊗V[m]
    end
    Ωchol = cholesky(Ω)
    Y = X * B + reshape(Ωchol.L * randn(n * d), n, d)
end

# maximum likelihood estimation
model = MRVCModel(Y, X, V)
fit!(model)

# residual maximum likelihood estimation
model = MRVCModel(Y, X, V; reml = true)
fit!(model)

References

  • H. Zhou, L. Hu, J. Zhou, and K. Lange: MM algorithms for variance components models (2019) (link)
  • M. Kim: Gene regulation in the human brain and the biological mechanisms underlying psychiatric disorders (2022) (link)

See also

  • J. Kim, J. Shen, A. Wang, D.V. Mehrotra, S. Ko, J.J. Zhou, and H. Zhou: VCSEL: Prioritizing SNP-set by penalized variance component selection (2021) (link)
  • L. Hu, W. Lu, J. Zhou, and H. Zhou: MM algorithms for variance component estimation and selection in logistic linear mixed models (2019) (link)
  • J.J. Zhou, T. Hu, D. Qiao, M.H. Cho, and H. Zhou: Boosting gene mapping power and efficiency with efficient exact variance component tests of single nucleotide polymorphism sets (2016) (link)

Contributors