Skip to content

Commit ddc5239

Browse files
committed
small changes
1 parent bf110d6 commit ddc5239

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

docs/src/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ where ``\boldsymbol{Y}`` and ``\boldsymbol{X}`` are ``n \times d`` response and
1818

1919
!!! warning
2020

21-
[MRVCModels.jl](https://github.com/hua-zhou/MultiResponseVarianceComponentModels.jl) is not suitable for biobank-scale data. We recommend using this package for datasets of size up to ``n \cdot d \approx 60000``. Further note that ``m`` can affect memory needed when calculating standard errors, since it will require ``m(nd)^2`` storage space.
21+
[MRVCModels.jl](https://github.com/hua-zhou/MultiResponseVarianceComponentModels.jl) is not suitable for biobank-scale data, except in the setting of ``m = 2``. For ``m > 2``, we recommend using this package for datasets of size up to ``n \cdot d \approx 60000``. Further note that large ``m`` can affect memory needed when calculating standard errors, since it will require ``m(nd)^2`` storage space.
2222

2323
# Installation
2424

src/MultiResponseVarianceComponentModels.jl

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
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.
54
"""
65
module MultiResponseVarianceComponentModels
76

@@ -113,7 +112,7 @@ end
113112
MRTVCModel(
114113
Y::AbstractVecOrMat,
115114
X::Union{Nothing, AbstractVecOrMat},
116-
V::Union{AbstractMatrix, Vector{<:AbstractMatrix}}
115+
V::Vector{<:AbstractMatrix}
117116
)
118117
119118
Create a new `MRVCModel` or `MRTVCModel` instance from response matrix `Y`,
@@ -295,7 +294,7 @@ struct MRTVCModel{T <: BlasReal} <: VCModel
295294
V :: Vector{Matrix{T}}
296295
U :: Matrix{T}
297296
D :: Vector{T}
298-
logdetV2 :: Vector{T}
297+
logdetV2 :: T
299298
# parameters
300299
B :: Matrix{T}
301300
Σ :: Vector{Matrix{T}}
@@ -405,7 +404,7 @@ function MRTVCModel(
405404
Bcov = Σcov = Bcov_reml = nothing
406405
end
407406
D, U = eigen(Symmetric(V[1]), Symmetric(V[2]))
408-
logdetV2 = [logdet(V[2])]
407+
logdetV2 = logdet(V[2])
409408
= transpose(U) * Y
410409
= p == 0 ? Matrix{T}(undef, n, 0) : transpose(U) * Xmat
411410
# parameters
@@ -448,6 +447,21 @@ function MRTVCModel(
448447
)
449448
end
450449

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+
451465
function Base.show(io::IO, model::VCModel)
452466
if model.reml
453467
n, d, p, m = size(model.Y_reml, 1), size(model.Y_reml, 2), size(model.X_reml, 2), length(model.V_reml)

src/fit.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ reltol::Real relative tolerance for convergence; default 1e-6
1111
verbose::Bool display algorithmic information; default true
1212
init::Symbol initialization strategy; :default initializes by least squares, while
1313
:user uses user-supplied values at model.B and model.Σ
14-
algo::Symbol optimization algorithm; :MM (default) or EM
14+
algo::Symbol optimization algorithm; :MM (default) or EM (for MRVCModel)
1515
log::Bool record iterate history or not; default false
1616
```
1717
"""

0 commit comments

Comments
 (0)