Public Documentation
Documentation for MixedModels.jl's public interface.
See Internal Documentation for internal package docs covering all submodules.
Contents
Index
Base.LinAlg.condMixedModels.LaplaceDevianceMixedModels.LinearMixedModelMixedModels.ScalarReMatMixedModels.VarCorrMixedModels.VectorReMatMixedModels.bootstrapMixedModels.fixefMixedModels.lmmMixedModels.lowerbdMixedModels.objectiveMixedModels.pirls!MixedModels.pwrssMixedModels.ranefMixedModels.refit!MixedModels.rematMixedModels.sdestMixedModels.simulate!MixedModels.varestStatsBase.coefStatsBase.coeftableStatsBase.devianceStatsBase.dfStatsBase.fit!StatsBase.fittedStatsBase.model_responseStatsBase.nobsStatsBase.vcov
MixedModels
#
MixedModels.LinearMixedModel — Type.
LinearMixedModel
Linear mixed-effects model representation
Members:
mf: 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: a lengthnvector of weightsA: 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.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 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
#
MixedModels.bootstrap — Function.
bootstrap(m, N, saveresults)
Simulate N response vectors from m, refitting the model. The function saveresults is called after each refit.
To save space m.trms[end], which is the response vector, is overwritten by each simulation. The original response is restored before returning.
Args:
m: aLinearMixedModelthat has been fit.N: the number of bootstrap samples to simulatesavresults: a function with argumentsiandmcalled after each bootstrap simulation. As the name indicates, this function should save the results of interest.
#
StatsBase.coef — Method.
nothing
#
StatsBase.coeftable — Method.
nothing
#
Base.LinAlg.cond — Method.
cond(m::MixedModel)
Args:
m: aMixedModel
Returns: A Vector of the condition numbers of the blocks of m.Λ
#
StatsBase.df — Method.
df(m)
Args:
m: aLinearMixedModel
Returns: Number of parameters in the model.
df(obj::StatisticalModel)
Returns the number of degrees of freedom consumed in the model, including when applicable the intercept and the distribution's dispersion parameter.
#
StatsBase.deviance — Method.
deviance(obj::StatisticalModel)
Returns the deviance of the model relative to a reference, which is usually when applicable the saturated model. It is equal, up to a constant, to -2 log L, with L the likelihood of the model.
#
StatsBase.fit! — Method.
fit!(m[, verbose = false]; optimizer = :LN_BOBYQA)
Optimize the objective of a LinearMixedModel using an NLopt optimizer.
Args:
m: aLinearMixedModelverbose:Boolindicating if information on iterations should be printed, Defaults tofalse
Named Args:
optimizer:Symbolform of the name of a derivative-free optimizer inNLoptthat allows for box constraints. Defaults to:LN_BOBYQA
#
StatsBase.fitted — Method.
nothing
#
MixedModels.fixef — Function.
fixef(m)
Args:
m: aLinearMixedModel
Returns: A Vector of estimates of the fixed-effects parameters of m
#
MixedModels.LaplaceDeviance — Function.
LaplaceDeviance(m)
Laplace approximation to the deviance of a GLMM
Args:
m: aGeneralizedLinearMixedModel
Returns: the Laplace approximation to the deviance of m
#
MixedModels.lmm — Function.
lmm(m::MixedModel)
Extract the LinearMixedModel from a MixedModel. If m is itself a LinearMixedModel this simply returns m. If m is a GeneralizedLinearMixedModel this returns its LMM member.
Args:
m: aMixedModel
Returns: A LinearMixedModel, either m itself or the LMM member of m
lmm(form, frm) lmm(form, frm; weights = wts)
Args:
form: aDataFrames:Formulacontaining fixed-effects and random-effects termsfrm: aDataFramein which to evaluateformweights: an optional vector of prior weights in the model. Defaults to unit weights.
Returns: A LinearMixedModel.
Notes: The return value is ready to be fit! but has not yet been fit.
#
MixedModels.lowerbd — Function.
lowerbd(m)
Args:
m: aMixedModel
Returns: A Vector of lower bounds on the covariance parameter vector m[:θ]
lower bounds on the parameters (elements in the lower triangle)
#
StatsBase.model_response — Method.
extract the response (as a reference)
#
StatsBase.nobs — Method.
nobs(obj::StatisticalModel)
Returns the number of independent observations on which the model was fitted. Be careful when using this information, as the definition of an independent observation may vary depending on the model, on the format used to pass the data, on the sampling plan (if specified), etc.
#
MixedModels.objective — Function.
objective(m)
Args:
m: aLinearMixedModelobject
Returns: Negative twice the log-likelihood of model m
#
MixedModels.pwrss — Function.
pwrss(m::LinearMixedModel)
Args:
m: aLinearMixedModel
Returns: The penalized residual sum-of-squares, a scalar.
#
MixedModels.pirls! — Function.
pirls!(m)
Use Penalized Iteratively Reweighted Least Squares (PIRLS) to determine the conditional modes of the random effects
Args:
m: aGeneralizedLinearMixedModel
Returns: the updated model m
Note: On entry the values of m.u₀ and m.devold should correspond. One safe approach is to zero out m.u₀ and evaluate devold from fixed-effects only.
#
MixedModels.ranef — Function.
ranef(m) ranef(m, uscale)
Conditional modes of the random effects in model m
Args:
m: a fittedMixedModelobjectuscale: aBoolindicating conditional modes are on theuscale or thebscale. Defaults tofalse
Returns: A Vector of matrices of the conditional modes of the random effects on the indicated scale. For a scalar random-effects term the matrix is 1 × k where k is the number of levels of the grouping factor. For a vector-valued random-effects term the matrix is l × k where l is the dimension of each random effect.
#
MixedModels.refit! — Function.
refit!(m, y)
Refit the model m with response y
Args:
m: aMixedModel{T}y: aVector{T}of lengthn, the number of observations inm
Returns: m after refitting
#
MixedModels.remat — Function.
remat(e,df)
A factory for ReMat objects
Args:
e: anExprwhich should be of the form:(e1 | e2)wheree1is a valid rhs of aFormulaandpool(e2)can be evaluated.df: aDataFramein which to evaluatee1ande2
Returns: a ScalarReMat or a VectorReMat, as appropriate.
#
MixedModels.sdest — Function.
sdest(m)
Args:
m: aLinearMixedModelobject
Returns: The scalar, s, the estimate of σ, the standard deviation of the per-observation noise
#
MixedModels.simulate! — Function.
simulate!(m; β, σ, θ)
Simulate a response vector from model m, and refit m.
Args:
m: aLinearMixedModel.β: the fixed-effects parameter vector to use; defaults tocoef(m)σ: the standard deviation of the per-observation random noise term to use; defaults tosdest(m)θ: the covariance parameter vector to use; defaults tom[:θ]
Returns: m after having refit it to the simulated response vector
#
MixedModels.varest — Function.
varest(m::LinearMixedModel)
Args:
m: aLinearMixedModel
Returns: The scalar, s², the estimate of σ², the variance of the conditional distribution of Y given B
#
StatsBase.vcov — Function.
vcov(m)
Estimated covariance matrix of the fixed-effects estimator
Args:
m: aLinearMixedModel
Returns a p × p Matrix