API

LMM

LMM

@covstr

Metida.@covstr

VarEffect

Metida.VarEffect

fit!

fit!

Metida.CovarianceType

Metida.CovarianceTypeType
CovarianceType(cm::AbstractCovmatMethod)

Make custom covariance type with CovmatMethod.

Example

customg = CovarianceType(CovmatMethod((q,p) -> (q, 1), Metida.gmat_csh!))
source

Metida.ScaledIdentity

Metida.ScaledIdentityFunction
ScaledIdentity()

Scaled identity covariance type.

SI = ScaledIdentity()

\[\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}\sigma^{2}\]

source

Metida.Diag

Metida.DiagFunction
Diag()

Diagonal covariance type.

DIAG = Diag()

\[\begin{bmatrix} \sigma_a^2 & 0 & 0 \\ 0 & \sigma_b^2 & 0 \\ 0 & 0 & \sigma_c^2 \end{bmatrix}\]

source

Metida.Autoregressive

Metida.AutoregressiveFunction
Autoregressive()

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\]

source

Metida.HeterogeneousAutoregressive

Metida.HeterogeneousAutoregressiveFunction
HeterogeneousAutoregressive()

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}\]

source

Metida.CompoundSymmetry

Metida.CompoundSymmetryFunction
CompoundSymmetry()

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\]

source

Metida.HeterogeneousCompoundSymmetry

Metida.HeterogeneousCompoundSymmetryFunction
HeterogeneousCompoundSymmetry()

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}\]

source

Metida.AutoregressiveMovingAverage

Metida.AutoregressiveMovingAverageFunction
AutoregressiveMovingAverage()

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\]

source

Metida.Toeplitz

Metida.ToeplitzFunction
Toeplitz()

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\]

source

Metida.ToeplitzParameterized

Metida.ToeplitzParameterizedFunction
ToeplitzParameterized(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)

source

Metida.HeterogeneousToeplitz

Metida.HeterogeneousToeplitzFunction
HeterogeneousToeplitz()

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}\]

source

Metida.HeterogeneousToeplitzParameterized

Metida.HeterogeneousToeplitzParameterizedFunction
HeterogeneousToeplitzParameterized(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)

source

Metida.SpatialExponential

Metida.SpatialExponentialFunction
SpatialExponential()
Warning

Experimental

Spatian Exponential covariance structure. Used only for repeated effect.

\[R_{i,j} = \sigma^{2} * exp(-dist(i,j)/exp(\theta))\]

where dist - Euclidean distance between row-vectors of repeated effect matrix for subject i and j.

SPEXP = SpatialExponential()

source

Metida.anova

Metida.anovaFunction
anova(lmm::LMM{T}; ddf::Symbol = :satter) where T
Warning

Experimental

Type III table.

source

Metida.isfitted

Metida.coef

StatsBase.coefFunction
StatsBase.coef(lmm::LMM) = copy(lmm.result.beta)

Model coefficients (β).

source

Metida.coefnames

Metida.confint

StatsBase.confintFunction
StatsBase.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

source

Metida.nobs

Metida.dof

Metida.dof_residual

Metida.dof_satter

Metida.dof_satterFunction
dof_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')$

source
dof_satter(lmm::LMM{T}, n::Int) where T

Return Satterthwaite approximation for the denominator degrees of freedom, where n - coefficient number.

source
dof_satter(lmm::LMM{T}) where T

Return Satterthwaite approximation for the denominator degrees of freedom for all coefficients.

source
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$
source

Metida.dof_contain

Metida.dof_containFunction
dof_contain(lmm, i)
Warning

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.

source

Metida.caic

Metida.caicFunction
caic(lmm::LMM)

Conditional Akaike Information Criterion.

source

Metida.aic

Metida.bic

Metida.aicc

Metida.vcov

Metida.stderror

Metida.modelmatrix

Metida.response

Metida.loglikelihood

Metida.lcontrast

Metida.gmatrix

Metida.rmatrix

Metida.vmatrix!

Metida.vmatrix!Function
vmatrix!(V, θ, lmm, i)

Update variance-covariance matrix V for i bolock.

source

Metida.thetalength

Metida.theta

Metida.rankx

Metida.hessian

Metida.getlog