API
LMM
@covstr
VarEffect
fit!
Metida.CovarianceType
Metida.CovarianceType
— TypeCovarianceType(cm::AbstractCovmatMethod)
Make covariance type with CovmatMethod.
Metida.ScaledIdentity
Metida.ScaledIdentity
— FunctionScaledIdentity()
Scaled identity covariance type.
SI = ScaledIdentity()
\[\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}\sigma^{2}\]
Metida.Diag
Metida.Diag
— FunctionDiag()
Diagonal covariance type.
DIAG = Diag()
\[\begin{bmatrix} \sigma_a^2 & 0 & 0 \\ 0 & \sigma_b^2 & 0 \\ 0 & 0 & \sigma_c^2 \end{bmatrix}\]
Metida.Autoregressive
Metida.Autoregressive
— FunctionAutoregressive()
Autoregressive covariance type.
AR = Autoregressive()
\[\begin{bmatrix} 1 & \rho & \rho^2 & \rho^3 \\ \rho & 1 & \rho & \rho^2 \\ \rho^2 & \rho & 1 & \rho \\ \rho^3 & \rho^2 & \rho & 1 \end{bmatrix}\sigma^2\]
Metida.HeterogeneousAutoregressive
Metida.HeterogeneousAutoregressive
— FunctionHeterogeneousAutoregressive()
Heterogeneous autoregressive covariance type.
ARH = HeterogeneousAutoregressive()
\[\begin{bmatrix} \sigma_a^2 & \rho\sigma_a\sigma_b & \rho^2\sigma_a\sigma_c & \rho^3\sigma_a\sigma_d \\ \rho\sigma_b\sigma_a & \sigma_b^2 & \rho\sigma_b\sigma_c & \rho^2\sigma_b\sigma_d \\ \rho^2\sigma_c\sigma_a & \rho\sigma_c\sigma_b & \sigma_c^2 & \rho\sigma_c\sigma_d \\ \rho^3\sigma_d\sigma_a & \rho^2\sigma_d\sigma_b & \rho\sigma_d\sigma_c & \sigma_d^2 \end{bmatrix}\]
Metida.CompoundSymmetry
Metida.CompoundSymmetry
— FunctionCompoundSymmetry()
Compound symmetry covariance type.
CS = CompoundSymmetry()
\[\begin{bmatrix} 1 & \rho & \rho & \rho \\ \rho & 1 & \rho & \rho \\ \rho & \rho & 1 & \rho \\ \rho & \rho & \rho & 1 \end{bmatrix}\sigma^2\]
Metida.HeterogeneousCompoundSymmetry
Metida.HeterogeneousCompoundSymmetry
— FunctionHeterogeneousCompoundSymmetry()
Heterogeneous compound symmetry covariance type.
CSH = HeterogeneousCompoundSymmetry()
\[\begin{bmatrix} \sigma_a^2 & \rho\sigma_a\sigma_b & \rho\sigma_a\sigma_c & \rho\sigma_a\sigma_d \\ \rho\sigma_b\sigma_a & \sigma_b^2 & \rho\sigma_b\sigma_c & \rho\sigma_b\sigma_d \\ \rho\sigma_c\sigma_a & \rho\sigma_c\sigma_b & \sigma_c^2 & \rho\sigma_c\sigma_d \\ \rho\sigma_d\sigma_a & \rho\sigma_d\sigma_b & \rho\sigma_d\sigma_c & \sigma_d^2 \end{bmatrix}\]
Metida.AutoregressiveMovingAverage
Metida.AutoregressiveMovingAverage
— FunctionAutoregressiveMovingAverage()
Autoregressive moving average covariance type.
ARMA = AutoregressiveMovingAverage()
\[\begin{bmatrix} 1 & \gamma & \gamma\rho & \gamma\rho^2 \\ \gamma & 1 & \gamma & \gamma\rho \\ \gamma\rho & \gamma & 1 & \gamma \\ \gamma\rho^2 & \gamma\rho & \gamma & 1 \end{bmatrix}\sigma^2\]
Metida.Toeplitz
Metida.Toeplitz
— FunctionToeplitz()
Toeplitz covariance type. Only for G matrix.
TOEP = Toeplitz()
\[\begin{bmatrix} 1 & \rho_1 & \rho_2 & \rho_3 \\ \rho_1 & 1 & \rho_1 & \rho_2 \\ \rho_2 & \rho_1 & 1 & \rho_1 \\ \rho_3 & \rho_2 & \rho_1 & 1 \end{bmatrix}\sigma^2\]
Metida.ToeplitzParameterized
Metida.ToeplitzParameterized
— FunctionToeplitzParameterized(p::Int)
Toeplitz covariance type with parameter p, (number of bands = p - 1, if p = 1 it's equal SI structure).
TOEPP(p) = ToeplitzParameterized(p)
Metida.HeterogeneousToeplitz
Metida.HeterogeneousToeplitz
— FunctionHeterogeneousToeplitz()
Heterogeneous toeplitz covariance type. Only for G matrix.
TOEPH = HeterogeneousToeplitz()
\[\begin{bmatrix} \sigma_a^2 & \rho_1 \sigma_a \sigma_b & \rho_2 \sigma_a \sigma_c & \rho_3 \sigma_a \sigma_d \\ \rho_1 \sigma_b \sigma_a & \sigma_b^2 & \rho_1 \sigma_b \sigma_c & \rho_2 \sigma_b \sigma_d \\ \rho_2 \sigma_c \sigma_a & \rho_1 \sigma_c \sigma_b & \sigma_c^2 & \rho_1 \sigma_c \sigma_d \\ \rho_3 \sigma_d \sigma_a & \rho_2 \sigma_d \sigma_b & \rho_1 \sigma_d \sigma_c & \sigma_d^2 \end{bmatrix}\]
Metida.HeterogeneousToeplitzParameterized
Metida.HeterogeneousToeplitzParameterized
— FunctionHeterogeneousToeplitzParameterized(p::Int)
Heterogeneous toeplitz covariance type with parameter p, (number of bands = p - 1, if p = 1 it's equal DIAG structure).
TOEPHP(p) = HeterogeneousToeplitzParameterized(p)
Metida.SpatialExponential
Metida.SpatialExponential
— FunctionSpatialExponential()
Spatian Exponential covariance structure. Used only for repeated effect.
\[R_{i,j} = \sigma^{2} * exp(-dist(i,j)/\theta)\]
where dist
- Euclidean distance between row-vectors of repeated effect matrix for subject i
and j
, θ > 0.
SPEXP = SpatialExponential()
Metida.SpatialPower
Metida.SpatialPower
— FunctionSpatialPower()
Experimental
Spatian Power covariance structure. Used only for repeated effect.
\[R_{i,j} = \sigma^{2} * \rho^{dist(i,j)}\]
where dist
- Euclidean distance between row-vectors of repeated effect matrix for subject i
and j
, 1 > ρ > -1.
SPPOW = SpatialPower()
Metida.SpatialGaussian
Metida.SpatialGaussian
— FunctionSpatialGaussian()
Experimental
Spatian Gaussian covariance structure. Used only for repeated effect.
\[R_{i,j} = \sigma^{2} * exp(- dist(i,j)^2 / \theta^2)\]
where dist
- Euclidean distance between row-vectors of repeated effect matrix for subject i
and j
, θ ≠ 0.
SPGAU = SpatialGaussian()
Metida.typeiii
Metida.typeiii
— Functiontypeiii(lmm::LMM{T}; ddf::Symbol = :satter) where T
Experimental
Type III table.
Metida.isfitted
StatsBase.isfitted
— FunctionStatsBase.isfitted(lmm::LMM)
Metida.coef
StatsBase.coef
— FunctionStatsBase.coef(lmm::LMM) = copy(lmm.result.beta)
Model coefficients (β).
Metida.coefnames
StatsBase.coefnames
— FunctionStatsBase.coefnames(lmm::LMM) = StatsBase.coefnames(lmm.mf)
Coefficients names.
Metida.confint
StatsBase.confint
— FunctionStatsBase.confint(lmm::LMM{T}; level::Real=0.95, ddf::Symbol = :satter) where T
Confidece interval for coefficients.
ddf = :satter/:residual
\[CI_{U/L} = β ± SE * t_{ddf, 1-α/2}\]
See also: dof_satter
, dof_residual
Metida.nobs
StatsBase.nobs
— FunctionStatsBase.nobs(lmm::MetiaModel)
Number of observations.
Metida.dof
StatsBase.dof
— FunctionStatsBase.dof(lmm::LMM)
DOF.
Metida.dof_residual
StatsBase.dof_residual
— FunctionStatsBase.dof_residual(lmm::LMM)
DOF residuals: N - rank(X).
Metida.dof_satter
Metida.dof_satter
— Functiondof_satter(lmm::LMM{T}, l) where T
Return Satterthwaite approximation for the denominator degrees of freedom, where l
is a contrast vector (estimable linear combination of fixed effect coefficients vector (β
).
\[df = \frac{2(LCL')^{2}}{g'Ag}\]
Where: $A = 2H^{-1}$, $g = \triangledown_{\theta}(LC^{-1}_{\theta}L')$
dof_satter(lmm::LMM{T}, n::Int) where T
Return Satterthwaite approximation for the denominator degrees of freedom, where n
- coefficient number.
dof_satter(lmm::LMM{T}) where T
Return Satterthwaite approximation for the denominator degrees of freedom for all coefficients.
dof_satter(lmm::LMM{T}, l::Matrix) where T
Return Satterthwaite approximation for the denominator degrees of freedom for conrast matrix l
.
For size(l, 1)
> 1:
\[df = \frac{2E}{E - rank(LCL')}\]
where:
- let $LCL' = QΛQ^{-1}$, where $QΛQ^{-1}$ - spectral decomposition of $LCL'$
- $Lq_i$ is the i-th row of $Q^{-1}L$
- $A = 2H^{-1}$, $g = \triangledown_{\theta}(Lq_i C^{-1}_{\theta} Lq_i')$
- $v_i = \frac{2*Λ_{i,i}^2}{g' * A * g}$
- $E = \sum_{i=1}^n {\frac{v_i}(v_i - 2)}$ for $v_i > 2$
Metida.dof_contain
Metida.dof_contain
— Functiondof_contain(lmm, i)
Experimental! Compute rank(XZi) for each random effect that syntactically contain factor assigned for β[i] element (Where Zi - Z matrix for random effect i). Minimum returned. If no random effect found N - rank(XZ) returned.
Metida.estimate
Metida.estimate
— Functionestimate(lmm, l::AbstractVector; level = 0.95, name = "Estimate")
Estimate table for l vector. Satter DF used.
estimate(lmm; level = 0.95)
Estimates table. Satter DF used.
Metida.caic
Metida.caic
— Functioncaic(lmm::LMM)
Conditional Akaike Information Criterion.
Metida.aic
StatsBase.aic
— FunctionStatsBase.aic(lmm::LMM)
Akaike Information Criterion.
Metida.bic
StatsBase.bic
— FunctionStatsBase.bic(lmm::LMM)
Bayesian information criterion.
Metida.aicc
StatsBase.aicc
— FunctionStatsBase.aicc(lmm::LMM)
Corrected Akaike Information Criterion.
Metida.vcov
StatsBase.vcov
— FunctionStatsBase.vcov(lmm::LMM)
Variance-covariance matrix of β.
Metida.stderror
StatsBase.stderror
— FunctionStatsBase.stderror(lmm::LMM)
Standard error
Metida.modelmatrix
StatsBase.modelmatrix
— FunctionStatsBase.modelmatrix(lmm::LMM)
Fixed effects matrix.
Metida.response
StatsBase.response
— FunctionStatsBase.response(lmm::LMM)
Response vector.
Metida.loglikelihood
StatsBase.loglikelihood
— FunctionStatsBase.loglikelihood(lmm::LMM)
Return loglikelihood value.
Metida.lcontrast
Metida.lcontrast
— Functionlcontrast(lmm::LMM, i::Int)
L-contrast matrix for i
fixed effect.
Metida.gmatrix
Metida.gmatrix
— Functiongmatrix(lmm::LMM{T}, r::Int) where T
Metida.rmatrix
Metida.rmatrix
— Functionrmatrix(lmm::LMM{T}, i::Int) where T
Metida.vmatrix!
Metida.vmatrix!
— Functionvmatrix!(V, θ, lmm, i)
Update variance-covariance matrix V for i bolock. Upper triangular updated.
Metida.thetalength
Metida.thetalength
— Functionthetalength(lmm::LMM)
Length of theta vector.
Metida.theta
Metida.theta
— Functiontheta(lmm::LMM)
Return theta vector.
Metida.rankx
Metida.rankx
— Functionrankx(lmm::LMM)
Return rank of X
matrix.
Metida.hessian
Metida.hessian
— Functionhessian(lmm, theta)
Calculate Hessian matrix of REML for theta.
Metida.getlog
Metida.getlog
— Functiongetlog(lmm::LMM)
Return fitting log.
Metida.rand
Base.rand
— Functionrand(rng::AbstractRNG, lmm::LMM{T}) where T
Generate random responce vector for fitted 'lmm' model.
rand(rng::AbstractRNG, lmm::LMM{T}; theta) where T
Experimental
Generate random responce vector 'lmm' model, theta covariance vector, and zero means.
rand(rng::AbstractRNG, lmm::LMM{T}; theta, beta) where T
Generate random responce vector 'lmm' model, theta covariance vector and mean's vector.
Metida.rand!
Missing docstring for Metida.rand
. Check Documenter's build log for details.