Public Documentation
Documentation for MixedModels.jl's public interface.
MixedModels
#
MixedModels.GeneralizedLinearMixedModel — Type.
GeneralizedLinearMixedModel
Generalized linear mixed-effects model representation
Members:
LMM: aLinearMixedModel- used for the random effects only.dist: aUnivariateDistribution- typicallyBernoulli(),Binomial(),Gamma()orPoisson().link: a suitableGLM.Linkobjectβ: the fixed-effects vectorθ: covariance parameter vectorb: similar tou, equivalent tobroadcast!(*, b, LMM.Λ, u)u: a vector of matrices of random effectsu₀: similar tou. Used in the PIRLS algorithm if step-halving is necessary.X:y: the response vectorμ: the mean vectorη: the linear predictordevresid: vector of squared deviance residualsoffset: offset₀ +X * βoffset₀: prior offset;T[]is allowedwrkresid: vector of working residualswrkwt: vector of working weightswt: vector of prior case weights, a value ofT[]indicates equal weights.
#
MixedModels.LinearMixedModel — Type.
LinearMixedModel
Linear mixed-effects model representation
Members
formula: the formula for the modelmf: the model frame, mostly used to get thetermscomponent for labelling fixed effectswttrms: a lengthntvector of weighted model matrices. The last two elements areXandy.trms: a vector of unweighted model matrices. Ifisempty(sqrtwts)the same object aswttrmsΛ: a lengthnt - 2vector of lower triangular matricessqrtwts: theDiagonalmatrix of the square roots of the case weights. Allowed to be size 0A: annt × ntsymmetric matrix of matrices representinghcat(Z,X,y)'hcat(Z,X,y)R: ant × ntmatrix of matrices - the upper Cholesky factor ofΛ'AΛ+Iopt: anOptSummaryobject
#
MixedModels.OptSummary — Type.
OptSummary
Summary of an NLopt optimization
Members
initial: a copy of the initial parameter values in the optimizationfinal: a copy of the final parameter values from the optimizationfmin: the final value of the objectivefeval: the number of function evaluationsoptimizer: the name of the optimizer used, as aSymbol
#
MixedModels.ReMat — Type.
ReMat
A representation of the model matrix for a random-effects term
#
MixedModels.ScalarReMat — Type.
ScalarReMat
The representation of the model matrix for a scalar random-effects term
Members
f: the grouping factor as aPooledDataVectorz: the raw random-effects model matrix as aVectorfnm: the name of the grouping factor as aSymbolcnms: aVectorof column names
#
MixedModels.VarCorr — Type.
VarCorr
An encapsulation of information on the fitted random-effects variance-covariance matrices.
Members
Λ: the vector of lower triangular matrices from theMixedModelfnms: aVector{ASCIIString}of grouping factor namescnms: aVector{Vector{ASCIIString}}of column namess: the estimate of σ, the standard deviation of the per-observation noise
The main purpose of defining this type is to isolate the logic in the show method.
#
MixedModels.VectorReMat — Type.
VectorReMat
The representation of the model matrix for a vector-valued random-effects term
Members
f: the grouping factor as aPooledDataVectorz: the transposed raw random-effects model matrixfnm: the name of the grouping factor as aSymbolcnms: aVectorof column names (row names after transposition) ofz
#
Base.LinAlg.cond — Method.
cond(m::MixedModel)
Returns the vector of the condition numbers of the blocks of m.Λ
#
Base.std — Method.
std{T}(m::MixedModel{T})
The estimated standard deviations of the variance components as a Vector{Vector{T}}.
#
MixedModels.LaplaceDeviance — Method.
LaplaceDeviance{T,D}(m::GeneralizedLinearMixedModel{T,D})
Return the Laplace approximation to the deviance of m.
If the distribution D does not have a scale parameter the Laplace approximation is defined as the squared length of the conditional modes, u, plus the determinant of Λ'Z'ZΛ + 1, plus the sum of the squared deviance residuals.
#
MixedModels.bootstrap! — Method.
bootstrap!{T}(r::Matrix{T}, m::LinearMixedModel{T}, f!::Function; β=fixef(m), σ=sdest(m), θ=getθ(m))
Overwrite columns of r with the results of applying the mutating extractor f! to parametric bootstrap replications of model m.
The signature of f! should be f!{T}(v::AbstractVector{T}, m::LinearMixedModel{T})
Named Arguments
β::Vector{T}, σ::T, and θ::Vector{T} are the values of the parameters in m for simulation of the responses.
#
MixedModels.cfactor! — Method.
cfactor!(A::AbstractMatrix)
A slightly modified version of chol! from Base
Uses inject! (as opposed to copy!), downdate! (as opposed to syrk! or gemm!) and recursive calls to cfactor!.
Note: The cfactor! method for dense matrices calls LAPACK.potrf! directly to avoid errors being thrown when A is computationally singular
#
MixedModels.fixef — Method.
fixef(m::MixedModel)
Returns the fixed-effects parameter vector estimate.
#
MixedModels.getθ — Method.
getθ(A::LowerTriangular{T, Matrix{T}})
Return a vector of the elements of the lower triangle of A (column-major ordering)
#
MixedModels.glmm — Method.
glmm(f::Formula, fr::ModelFrame, d::Distribution[, l::GLM.Link])
Return a GeneralizedLinearMixedModel object.
The value is ready to be fit! but has not yet been fit.
#
MixedModels.lmm — Method.
lmm(f::DataFrames.Formula, fr::DataFrames.DataFrame; weights = [])
Create a LinearMixedModel from f, which contains both fixed-effects terms and random effects, and fr.
The return value is ready to be fit! but has not yet been fit.
#
MixedModels.lmm — Method.
lmm(m::MixedModel)
Extract the LinearMixedModel from a MixedModel.
If m is a LinearMixedModel return m. If m is a GeneralizedLinearMixedModel return m.LMM.
#
MixedModels.lowerbd — Method.
lowerbd{T}(A::LowerTriangular{T,Matrix{T}})
Return the vector of lower bounds on the parameters, θ.
These are the elements in the lower triangle in column-major ordering. Diagonals have a lower bound of 0. Off-diagonals have a lower-bound of -Inf.
#
MixedModels.lowerbd — Method.
lowerbd(m::LinearMixedModel)
Return the vector of lower bounds on the covariance parameter vector θ
#
MixedModels.objective — Method.
objective(m::LinearMixedModel)
Return negative twice the log-likelihood of model m
#
MixedModels.pirls! — Method.
pirls!(m::GeneralizedLinearMixedModel)
Use Penalized Iteratively Reweighted Least Squares (PIRLS) to determine the conditional modes of the random effects.
#
MixedModels.pwrss — Method.
pwrss(m::LinearMixedModel)
The penalized residual sum-of-squares.
#
MixedModels.ranef — Function.
ranef{T}(m::MixedModel{T}, uscale=false)
Returns, as a Vector{Matrix{T}}, the conditional modes of the random effects in model m.
If uscale is true the random effects are on the spherical (i.e. u) scale, otherwise on the original scale.
#
MixedModels.refit! — Method.
refit!{T}(m::LinearMixedModel{T}[, y::Vector{T}])
Refit the model m after installing response y.
If y is omitted the current response vector is used.
#
MixedModels.remat — Method.
remat(e::Expr, df::DataFrames.DataFrame)
A factory for ReMat objects.
e should be of the form :(e1 | e2) where e1 is a valid rhs of a Formula and pool(e2) can be evaluated within df. The result is a ScalarReMat or a VectorReMat, as appropriate.
#
MixedModels.sdest — Method.
sdest(m::LinearMixedModel)
Return the estimate of σ, the standard deviation of the per-observation noise.
#
MixedModels.setθ! — Method.
setθ!{T}(m::LinearMixedModel{T}, v::Vector{T})
Install v as the θ parameters in m. Changes m.Λ only.
#
MixedModels.simulate! — Method.
simulate!(m::LinearMixedModel; β=fixef(m), σ=sdest(m), θ=getΘ(m))
Overwrite the response (i.e. m.trms[end]) with a simulated response vector from model m.
#
MixedModels.varest — Method.
varest(m::LinearMixedModel)
Returns the estimate of σ², the variance of the conditional distribution of Y given B.
#
StatsBase.fit! — Function.
fit!(m::LinearMixedModel[, verbose::Bool=false[, optimizer::Symbol=:LN_BOBYQA]])
Optimize the objective of a LinearMixedModel.
A value for optimizer should be the name of an NLopt derivative-free optimizer allowing for box constraints.
#
StatsBase.fit! — Function.
fit!(m::GeneralizedLinearMixedModel[, verbose = false, optimizer=:LN_BOBYQA]])
Optimize the objective function for m
#
StatsBase.vcov — Method.
vcov(m::MixedModel)
Returns the estimated covariance matrix of the fixed-effects estimator.