|
1 | 1 | """
|
2 |
| -`MultiResponseVarianceComponentModels.jl` or `MRVCModels.jl` permits maximum |
3 |
| -likelihood (ML) and residual maximum likelihood (REML) estimation as well as inference |
4 |
| -for multivariate response variance components linear mixed models. |
| 2 | +`MRVCModels.jl` permits maximum likelihood (ML) and residual maximum likelihood (REML) estimation |
| 3 | +as well as inference for multivariate response variance components linear mixed models. |
5 | 4 | """
|
6 | 5 | module MultiResponseVarianceComponentModels
|
7 | 6 |
|
|
113 | 112 | MRTVCModel(
|
114 | 113 | Y::AbstractVecOrMat,
|
115 | 114 | X::Union{Nothing, AbstractVecOrMat},
|
116 |
| - V::Union{AbstractMatrix, Vector{<:AbstractMatrix}} |
| 115 | + V::Vector{<:AbstractMatrix} |
117 | 116 | )
|
118 | 117 |
|
119 | 118 | Create a new `MRVCModel` or `MRTVCModel` instance from response matrix `Y`,
|
@@ -295,7 +294,7 @@ struct MRTVCModel{T <: BlasReal} <: VCModel
|
295 | 294 | V :: Vector{Matrix{T}}
|
296 | 295 | U :: Matrix{T}
|
297 | 296 | D :: Vector{T}
|
298 |
| - logdetV2 :: Vector{T} |
| 297 | + logdetV2 :: T |
299 | 298 | # parameters
|
300 | 299 | B :: Matrix{T}
|
301 | 300 | Σ :: Vector{Matrix{T}}
|
@@ -405,7 +404,7 @@ function MRTVCModel(
|
405 | 404 | Bcov = Σcov = Bcov_reml = nothing
|
406 | 405 | end
|
407 | 406 | D, U = eigen(Symmetric(V[1]), Symmetric(V[2]))
|
408 |
| - logdetV2 = [logdet(V[2])] |
| 407 | + logdetV2 = logdet(V[2]) |
409 | 408 | Ỹ = transpose(U) * Y
|
410 | 409 | X̃ = p == 0 ? Matrix{T}(undef, n, 0) : transpose(U) * Xmat
|
411 | 410 | # parameters
|
@@ -448,6 +447,21 @@ function MRTVCModel(
|
448 | 447 | )
|
449 | 448 | end
|
450 | 449 |
|
| 450 | +MRTVCModel(Y::AbstractMatrix, x::AbstractVector, V::Vector{<:AbstractMatrix}; kwargs...) = |
| 451 | + MRTVCModel(Y, reshape(x, length(x), 1), V; kwargs...) |
| 452 | + |
| 453 | +MRTVCModel(y::AbstractVector, X::AbstractMatrix, V::Vector{<:AbstractMatrix}; kwargs...) = |
| 454 | + MRTVCModel(reshape(y, length(y), 1), X, V; kwargs...) |
| 455 | + |
| 456 | +MRTVCModel(y::AbstractVector, x::AbstractVector, V::Vector{<:AbstractMatrix}; kwargs...) = |
| 457 | + MRTVCModel(reshape(y, length(y), 1), reshape(x, length(x), 1), V; kwargs...) |
| 458 | + |
| 459 | +MRTVCModel(Y::AbstractMatrix, V::Vector{<:AbstractMatrix}; kwargs...) = |
| 460 | + MRTVCModel(Y, nothing, V; kwargs...) |
| 461 | + |
| 462 | +MRTVCModel(y::AbstractVector, V::Vector{<:AbstractMatrix}; kwargs...) = |
| 463 | + MRTVCModel(reshape(y, length(y), 1), nothing, V; kwargs...) |
| 464 | + |
451 | 465 | function Base.show(io::IO, model::VCModel)
|
452 | 466 | if model.reml
|
453 | 467 | n, d, p, m = size(model.Y_reml, 1), size(model.Y_reml, 2), size(model.X_reml, 2), length(model.V_reml)
|
|
0 commit comments