API

LMM

LMM

@covstr

Metida.@covstr

VarEffect

Metida.VarEffect

fit!

fit!

@lmmformula

Metida.@lmmformulaMacro
@lmmformula(formula, args...)

Macro for made formula with variance-covariance structure representation. @lmmformula could be used for shorter LMM construction.

Example:

lmm = Metida.LMM(@lmmformula(var~sequence+period+formulation,
random = formulation|subject:CSH,
repeated = formulation|subject:DIAG),
df0)

equal to:

lmm = LMM(@formula(var~sequence+period+formulation), df0;
random = Metida.VarEffect(@covstr(formulation|subject), CSH),
repeated = Metida.VarEffect(@covstr(formulation|subject), DIAG),
)

@lmmformula have 3 components - 1'st is a formula for fixed effect, it's defined like in StstsModels (1st argument just provided to @formula macro). Other arguments should be defined like keywords. repeated keyword define repeated effect part, random - define random effect part. You can use several random factors as in example bellow:

lmm = Metida.LMM(Metida.@lmmformula(var~sequence+period+formulation,
random = formulation|subject:CSH,
random = 1|subject:DIAG,
repeated = formulation|subject:DIAG),
df0)

random or repeated structure made by template:

effect formula | blocking factor [/ nested factor] [: covariance structure]

| - devide effect formula form blocking factor definition (necessarily), / and : modificator are optional.

/ work like in MixedModels or in RegressionFormulae - expand factor f|a/b to f|a + f|a&b. It can't be used in repeated effect definition.

: - covariance structure defined right after : (SI, DIAG, CS, CSH, ets...), if : not used then SI used for this effect.

Terms like a+b or a*b shuould not be used as a blocking factors.

source

Metida.CovarianceType

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()

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()

source

Metida.SpatialPower

Metida.SpatialPowerFunction
SpatialPower()
Warning

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()

source

Metida.SpatialGaussian

Metida.SpatialGaussianFunction
SpatialGaussian()
Warning

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()

source

Metida.Unstructured

Metida.UnstructuredFunction
Unstructured()

Unstructured covariance structure with t*(t+1)/2-t paremeters where t - number of factor levels, t*(t+1)/2-2t of them is covariance (ρ) patemeters.

UN = Unstructured()

source

Metida.typeiii

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

Experimental

Type III table.

source

Metida.isfitted

Metida.coef

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

Model coefficients (β).

source

Metida.coefnames

Metida.confint

StatsAPI.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
StatsBase.confint(lmm::LMM{T}, i::Int; level::Real=0.95, ddf::Symbol = :satter) where T

Confidece interval for coefficient i.

source
StatsBase.confint(br::BootstrapResult, n::Int; level::Float64=0.95, method=:jn)

Confidence interval for bootstrap result.

*method:

  • :bp - bootstrap percentile;
  • :rbp - reverse bootstrap percentile;
  • :norm - Normal distribution;
  • :bcnorm - Bias corrected Normal distribution;
  • :jn - bias corrected (jackknife resampling).
source

Metida.nobs

Metida.dof

Metida.dof_residual

StatsAPI.dof_residualFunction
StatsBase.dof_residual(lmm::LMM)

DOF residuals: N - rank(X), where N - total number of observations.

source

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.estimate

Metida.estimateFunction
estimate(lmm, l::AbstractVector; level = 0.95, name = "Estimate")

Estimate table for l vector. Satter DF used.

source
estimate(lmm; level = 0.95)

Estimates table. Satter DF used.

source

Metida.caic

Metida.caicFunction
caic(lmm::LMM)

Conditional Akaike Information Criterion.

source

Metida.aic

Metida.bic

Metida.aicc

StatsAPI.aiccFunction
StatsBase.aicc(lmm::LMM)

Corrected Akaike Information Criterion.

source

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. Upper triangular updated.

source

Metida.thetalength

Metida.theta

Metida.rankx

Metida.hessian

Metida.getlog

Metida.rand

Base.randFunction
rand(rng::AbstractRNG, lmm::LMM{T}) where T

Generate random responce vector for fitted 'lmm' model.

source
rand(rng::AbstractRNG, lmm::LMM{T}; theta) where T
Warning

Experimental

Generate random responce vector 'lmm' model, theta covariance vector, and zero means.

source
rand(rng::AbstractRNG, lmm::LMM{T}; theta, beta) where T

Generate random responce vector 'lmm' model, theta covariance vector and mean's vector.

source

Metida.rand!

Missing docstring.

Missing docstring for Metida.rand. Check Documenter's build log for details.