- Additional methods for pre-allocated result arrays and
*Configinstances have been added to the ForwardDiff extension. #871 - New exported function
objective_gradient!evaluating the analytic gradient of the objective of aLinearMixedModel(ML and REML, including fixedσ) directly from the blocked Cholesky factor. It is much faster and allocates far less than automatic differentiation via the ForwardDiff extension, especially for models with many covariance parameters. The small per-face and per-block products for terms of dimension up to 8 use statically sized, unrolled kernels instead of BLAS calls, whose overhead would dominate the handful of flops. #903 - The NLopt backend now supports the gradient-based optimizers
:LD_LBFGS,:LD_MMA, and:LD_SLSQPforLinearMixedModel, usingobjective_gradient!. The default optimizer remains derivative-free:LN_NEWUOA; select a gradient-based one with e.g.fit(MixedModel, form, data; optimizer=:LD_LBFGS). Internally the gradient-based optimizers work on a per-observation scaling of the objective, which keeps line searches well behaved for large data sets;fitlog, the progress display, and the reportedfminremain on the deviance scale, andftol_absacts as a per-observation tolerance for these optimizers. #903 - The gradient source for gradient-based optimizers can be selected with the new
gradientkeyword argument tofit/fit!(stored inOptSummary): the default:analyticusesobjective_gradient!, while:forwarddiffuses forward-mode automatic differentiation and requires that ForwardDiff.jl be loaded. The:forwarddiffsource reuses a cached, dual-valued copy of the model's numerical fields across evaluations. #903 - The density threshold below which
objective_gradient!exploits the sparsity of blocks between scalar random-effects terms, instead of using dense BLAS-3 kernels, can be set via the newOptSummaryfieldgradient_sparse_density(default 0.03) or thesparse_densitykeyword ofMixedModels.GradientWorkspace. It affects only speed and memory use. The best value depends on the number of BLAS threads and on the size of the dense diagonal block ofLfor the second term: with 4 BLAS threads, a threshold of 0.05 is 1.5× faster onelp_ldt(814 levels) but 1.5× slower onml1m(3706 levels) at the same density. #903 - The ForwardDiff extension has been reworked to reuse the core linear-algebra routines (which have gained generic fallback methods for element types without BLAS/LAPACK support) instead of maintaining parallel
fd_*implementations. The objective it differentiates now profilesσ(or holds it atoptsum.sigmawhen fixed), matchingobjective, soForwardDiff.gradientandForwardDiff.hessiannow refer to the profiled objective; the Hessian of a model fitted with a fixedσis now computed at that fixed value.fd_deviancealso now includes the constant weights term for weighted models, matchingobjective. #903
- New keyword argument
densethresholdforLinearMixedModel,GeneralizedLinearMixedModelandfit(MixedModel, ...): the proportion of nonzeros above which an off-diagonal block ofAandLis stored densely instead of as a sparse matrix. It affects only speed and memory use, not the fitted model. It also replaces the fixed cutoff of 0.25 above which the cross-product of two vector-valued random-effects terms was always stored densely. - The default threshold for storing an off-diagonal block of
AandLdensely has been raised from 0.1 to 0.25, so blocks with 10–25% nonzeros now stay sparse. For example, a 45 × 541475 block with 11% nonzeros now stays sparse, which makes evaluating the objective about 1.4× faster and halves the memory forL. A block with 39% nonzeros was 6× faster to evaluate when stored densely, so the threshold was not raised further. Passdensethreshold=0.1to restore the previous storage. GeneralizedLinearMixedModelandfit(GeneralizedLinearMixedModel, ...)now also accept theRFPthresholdandsortlevelskeyword arguments ofLinearMixedModel.#926
- Computing
allpars,σsandshortestcovintfor aMixedModelBootstrapis now linear instead of quadratic in the number of replicates. For 10,000 replicates,shortestcovintis roughly 70–80x faster. #925 - The NLopt backend no longer returns a parameter vector that was never evaluated. NLopt's NEWUOA optimizer, the default for linear mixed models, can return a point built from uninitialized memory when it stops during its initialization phase, e.g. because
maxfevalormaxtimewas reached (stevengj/nlopt#667). This could result in aPosDefExceptionor a meaningless model. The best evaluated point is now used instead. #925
- Numerous correctness fixes for likelihood profiles (
profile) and the confidence intervals computed from them (confint(::MixedModelProfile)). Several of these change previously reported intervals. #917- The fixed-effects coefficients are no longer profiled for models fit by REML, since they are integrated out of the REML criterion; a warning suggests refitting by maximum likelihood. The previous fixed-effects profiles for REML fits compared ML and REML objectives and were not meaningful. The workaround that swapped flipped confidence limits for REML fits (#785) has been removed, as the flipped limits were a symptom of this problem.
- Fixed-effects profiles now account for the model weights, use the correct coefficient for rank-deficient models (which previously could also profile indefinitely), and report the correct correlations in the profile table.
- The profile of a variance component at zero is now computed exactly rather than borrowed from other profiles, and the profiles of variance components now extend until they reach the threshold. For example, the lower 95% limit for the standard deviation of the random slopes in
reaction ~ 1 + days + (1 + days | subj)for thesleepstudydata is now 3.80 instead of 0. - Variance components of
zerocorrterms are no longer silently omitted fromconfint, andσsandσρsalways report non-negative standard deviations. - Profiling no longer fails for responses on a small scale, for correlated random-effects terms with the PRIMA backend, when a row of the relative covariance factor is zero, or when the profile of a variance component reaches zero for a correlated term.
- Profiles of θ or of the variance components that are flat or not monotone, e.g. for poorly identified models, no longer abort profiling. Instead, the affected splines are omitted from the profile with a warning, so the
fwdandrevfields may not contain every parameter.confintreports such parameters with their estimate andNaNlimits instead of omitting them. - When profiling finds an objective value below the reported minimum, i.e. the model fit had not converged, an informative
ArgumentErroris thrown instead of aDomainError. profilenow restores all of the model'sOptSummaryafterwards, includingfevalandfinitial.- Profiling is very slightly faster: the refits in the profiles of σ and the fixed effects are warm started from the previous point, and a duplicate optimization in the θ profiles has been removed.
refit!andunfit!forLinearMixedModelaccept awarm_startkeyword argument to start the optimization from the current parameter estimates instead of the default initial values. #917- The PRIMA backend now starts the optimization from
optsum.initial, as the NLopt backend does. #917
- Package extension for Vcov.jl providing sandwich estimators of the covariance of the fixed effects of a
LinearMixedModel:vcov(m, Vcov.cluster(...))(cluster-robust CR1, one- or multiway, clustering on grouping factors of the model or user-supplied clusters),vcov(m, Vcov.robust())(heteroskedasticity-robust HC1), andvcov(m, Vcov.simple())(equivalent tovcov(m)). The estimators use the GLS bread and scores and do not form the marginal covariance matrix of the response. GLMMs are not (yet) supported. #768 vcov,stderror,coeftableandshowforMixedModels accept a covariance estimator (aStatsBase.CovarianceEstimator, e.g. from Vcov.jl) as an optional final positional argument, e.g.stderror(m, Vcov.cluster(:subj))orcoeftable(m, Vcov.cluster(:subj)). The default,StatsBase.SimpleCovariance(), is the model-based estimator. #768
- Use
dispersion_parameterinstead of checking for supported distributions before warning for GLMMs with a dispersion parameter.#924
- The
rankUpdate!method for aDiagonalblock ofLupdated from aSparseMatrixCSCnow accepts columns with no stored entries; previously it required exactly one stored entry per column. On newer Julia versions, the 5-argument sparsemul!inupdateL!drops exact zeros from its result, which can happen when an element of θ is zero, and this caused a spuriousArgumentErrorwhen fitting some models, e.g. a GLMM forgrouseticks. #918 - The precompile workflow now uses simulated data instead of relying on
MixedModelsDatasets. This should speed up precompilation and improve its reliability since no data needs to be downloaded.#919
predictnow accepts aβkeyword argument for supplying a custom fixed-effects coefficient vector instead of the model's own fitted estimates. As withsimulate!,βmay be given either as a pivoted, full-rank vector (cf.fixef) or an unpivoted, full-dimension vector (cf.coef), with entries for redundant columns ignored. The default behavior (using the model's own estimates) is unchanged. #916
- Remove dependency in
docs/Project.tomlonMixedModelsSerializationwhich was holding up other package version updates. #915 - Also adjust compat entries in
docs/Project.tomlforAlgebraOfGraphicsandFreqTables
- JSON backend for
saveoptsumandrestoreoptsum!has been changed from JSON3.jl to JSON.jl. JSON3.jl has been deprecated in favor of JSON.jl. As a result, the dependency onStructTypes.jlhas also been dropped. #897
datasetis now public to avoid warnings when used directly. Users are nonetheless encouraged to load MixedModelsDatasets.jl directly. #911
- The sparse
rankUpdate!of a diagonal block ofLhas been reworked, for both RFP and dense storage of the block. Rather than going throughnzrangeand indexing into the resulting range, both kernels now walk thecolptrof the update directly, carrying a running index intorowvalandnzval. This removes a level of indirection from the inner loops and hoists the offset of the target column out of them. #910 - In the RFP kernel, the per-element assertion that row indices are sorted within a column has been replaced by a single
issortedcheck per column. That check is what makes the inner loops safe to mark@inbounds, and performing it once per column is far cheaper than once per element of the quadratic inner loops. #910 - Relative to v5.8.0, the RFP kernel is roughly 1.65× faster on
instevaland 1.1× faster on an example too large for cache, which closes most of the gap between RFP and dense storage noted below: oninstevalthe RFP update went from about 60% slower than the dense one to under 10% slower. The dense kernel itself gains about 15% when the block fits in cache and little when it does not. #910 rankUpdate!on aHermitianRFPthat is not in lower, non-transposed storage now reports the offendingtransranduploin theArgumentError. #910
- Allow for diagonal blocks of
Lto be stored inRectangularFullPacked(RFP) format, which saves roughly half the storage required for the block. This can increase the time required forupdateL!, primarily in therankUpdate!step, resulting in a time vs. memory tradeoff. The size threshold for RFP storage is a new optional argumentRFPthreshold, which defaults to 1000. - The RFP format stores a triangular matrix in two pieces: a trapezoidal part of roughly 3/4 of the elements, where linear indexing can be used for the updates, and a transposed triangular part with more complicated
getindexandsetindex!methods. - A new Boolean optional argument,
sortlevels, which defaults totrue, sorts the levels of each grouping factor other than the leading one by decreasing number of occurrences. This applies to both dense and RFP storage of the diagonal blocks ofL: placing the most frequent levels first concentrates the sparserankUpdate!of a block in a compact corner of its storage, which improves memory locality. For RFP storage it additionally keeps more of those updates in the trapezoid part of the block. This is a heuristic, not guaranteed to be optimal, but it works well in examples we have tried. #821
- Compat bump for MixedModelsDatasets. Note that some data values have changed in their least significant digits, which can change statistics computed from these. Additionally, MixedModelsDatasets now lazily downloads individual datasets instead of downloading all available datasets as a single bundle. #904
fittedandpredicthave been reworked to allocate less and avoid some unnecessary computation. #887
- Several previously hardcoded parameters related to PIRLS are now exposed and can be set by modifying
optsum.#893
- Import
log2πdirectly fromIrrationalConstantsinstead of via theStatsFunsre-export chain.IrrationalConstantsis now a direct dependency, but it was already an indirect dependency of the package. #898 - Replace the remaining
chisqccdfandnormccdfcalls with the equivalentccdf(Chisq(…), …)andccdf(Normal(), …)fromDistributions, and dropStatsFunsas a direct dependency.StatsFunsremains in the indirect dependency graph viaStatsModelsandDistributions. #899
- Fixed a bug in testing the nesting of fixed effects. #891
- Fixed an edge case in
predictwith rank deficient models. #892
- The construction of
LinearMixedModelhas changed so that the storage of the full-rank fixed-effects model matrix is shared betweenfetermandXymat. The functionmodelmatrixstill returns the entire model matrix (including redundant columns), but now constructs it dynamically instead of returning a reference into internal storage. The precise storage details ofFeTermhave changed. #889
- Change
isnested(x, y)for MixedModels to returntrueifxhas no fixed-effects parameters #886
varestanddispersion(::LinearMixedModel, true)previously incorrectly returned the estimated standard deviation instead of the variance for models with a fixed sigma parameter. #885
- Implement
sparseLas a specialization ofsparsemat. Replace_coordutility with_findnzwhich, in most cases, falls through toSparseArrays.findnz. #880
- Small update to
showmethods to accommodate coming changes in Julia Markdown stdlib. #876
- Use three-argument method for
showforCoefTables. #875
- The use of the
wtskeyword argument has been deprecated in favor of the keyword argumentweights, in line with the deprecation in GLM.jl v1.9.1. The usage (and subsequent interpretation) remains otherwise unchanged. #873
- Nesting checks for the likelihoodratio test have been slightly tweaked to be more robust, at the cost of being slightly slower. In particular, the comparison of models with pre-centered variables with those with variables centered via StandardizedPredictors.jl was previously incorrectly rejected as non-nested, but should be correctly accepted as nested now. Additionally, some further logging messages are emitted when a nesting check fails. #867
- Small update in some code related to displaying dispersion parameters in cases where inference has failed. #865
lowerbd(::MixedModel)returns the canonical lower bounds of a model's parameters, i.e. the expected bounds after rectification in unconstrained optimization. #864
- The default display and
confintmethods for bootstrap results from models without dispersion parameters has been fixed. #861
- Fixes a method error with
Grouping()contrasts when used with recent CategoricalArray releases. #860
- Optimization is now performed without constraints. In a post-fitting step, the Cholesky factor is canonicalized to have non-negative diagonal elements. #840
- The default optimizer has changed to NLopt's implementation of NEWUOA where possible. NLopt's implementation fails on 1-dimensional problems, so in the case of a single, scalar random effect, BOBYQA is used instead. In the future, the default optimizer backend will likely change to PRIMA and NLopt support will be moved to an extension. Blocking this change in backend is an issue with PRIMA.jl when running in VSCode's built-in REPL on Linux. #840
- [BREAKING] Support for constrained optimization has been completely removed, i.e. the field
lowerbdhas been removed fromOptSummary. #849 - [BREAKING] The deprecated
use_threadskwarg has been dropped fromparametricbootstrap. It had been a no-op since v4.10.0. #841 - [BREAKING] The deprecated
hide_progresskwarg has been dropped fromparametricbootstrap. It had been replaced byprogresssince v4.22.0. #841 - [BREAKING] A fitlog is always kept -- the deprecated keyword argument
thinhas been removed as has thefitlogkeyword argument. #850 - The fitlog is now stored as Tables.jl-compatible column table. #850
- Internal code around the default optimizer has been restructured. In particular, the NLopt backend has been moved to a submodule, which will make it easier to move it to an extension if we promote another backend to the default. #853
- Internal code around optimization in profiling has been restructuring so that fitting done during calls to
profilerespect thebackendandoptimizersettings. #853 - The
prfit!convenience function has been removed. #853 - The
datasetanddatasetsfunctions have been removed. They are now housed inMixedModelsDatasets.#854 - The local implementation of
fulldummyand the nesting syntax has been removed and a dependency on RegressionFormulae.jl for their implementation has been added. #855 - One argument
predict(::GeneralizedLinearMixedModel), i.e. prediction on the original data, now supports thetypekeyword argument. #856 isnested(A::ReMat, B::ReMat)is now a method ofStatsModels.isnested.#858- [BREAKING ]
likelihoodratiotesthas been reworked to be a thin wrapper aroundStatsModels.lrtest. The historical difference in behavior in terms of nesting checks created some confusion. Users advanced enough to create models with non-obvious nesting are assumed to be advanced enough to manually compute the likelihood ratio test. The functionlikelihoodratiotestand associatedLikelihoodRatioTesttype (now with a type parameter for number of models) has been kept to enable printing of test results with model formulae. Most users should not notice a difference in behavior, but the display has been slightly changed and the internal field structure has changed.#858 - Failures to fit a spline in profiling now generates a more helpful error message. #857
- Experimental support for evaluating
FiniteDiff.finite_difference_gradientandFiniteDiff.finite_difference_hessian of the objective of a fittedLinearMixedModel`. #842
- Experimental support for evaluating
ForwardDiff.gradientandForwardDiff.hessianof the objective of a fittedLinearMixedModel. #841
- Automatic application of grouping contrasts now works for
RandomEffectsTerms constructed programmatically, e.g. with(term(1) | term(:g)). #836
- Update to the
show(::IO, ::MIME, x)methods for consistent ordering across Julia versions of variance components without associated fixed effects. This may result in change of ordering on existing Julia versions, but ordering will now match the ordering in the default REPL display (and reflect the model internal ordering), #829
- The final parameter vector
optsum.finalis now reset in calls tounfit!. This has the secondary effect of correctly starting the fit forprfit!at the initial parameter vector instead of the final parameter vector of any previous optimization. #828
StatsAPI.cooksdistance(::LinearMixedModel)is now defined and exported. #825
- Allow v0.19.0 of
BSplineKit.jlto avoid warnings inbetaandnightlyversions of julia. #823
BlockedSparseis now immutable. #815
LikelihoodRatioTestnow extendsStatsAPI.HypothesisTestand provides a method forStatsAPI.pvalue. #814
- Added
lmmandglmmas convenience wrappers forfit(LinearMixedModel, ...)andfit(GeneralizedLinearMixedModel, ...)respectively #810
- Added aliases
settheta!andprofilesigmafor the functionssetθ!andprofileσrespectively
- Refactor calls to backend optimizer to make it easier to add and use different optimization backends.
The structure of
OptSummaryhas been accordingly expanded andprfit!has been updated to use this new structure. #802 - Make the
thinargument tofit!a no-op. It complicated several bits of logic without having any real performance benefit in the majority of cases. This argument has been replaced with afitlog::Bool=falsethat determines whether a log is kept.#802
- Populate
optsuminprfit!call. #801
- Testbed for experimental support for using PRIMA as an optimization backend introduced via the experimental
prfit!function. #799 - Julia compat bound raised to current 1.10, i.e. current LTS. #799
GeneralizedLinearMixedModelnow attempts to fall back to very constrained variance values when the default initial values result in a non positive semidefinite covariance matrix. #792
profilenow includes afinallyblock to restore the original model even if an error occurs before profiling is complete #795
saveoptsumandrestoreoptsum!now supportGeneralizedLinearMixedModels #791unfit!(::GeneralizedLinearMixedModel)(called internally byrefit!) now does a better job of fully resetting the model state #791
- lower and upper edges of profile confidence intervals for REML-fitted models are no longer flipped #785
issingularnow accepts comparison tolerances through the keyword argumentsatolandrtol. #783
- Added additional precompilation for rePCA. #749
- Fix a bug in the handling of rank deficiency in the
simulate[!]code. This has important correctness implications for bootstrapping models with rank-deficient fixed effects (as can happen in the case of partial crossing of the fixed effects / missing cells). #778
- Use
publickeyword so that users don't see unnecessary docstring warnings on 1.11+. #776 - Fix accidental export of
datasetanddatasetsand make thempublicinstead. #776
- Use more sophisticated checks on property names in
restoreoptsumto allow for optsums saved by pre-v4.25 versions to be used with this version and later. #775
- Add type notations in
pwrss(::LinearMixedModel)andlogdet(::LinearMixedModel)to enhance type inference. #773 - Take advantage of type parameter for
StatsAPI.weights(::LinearMixedModel{T}). #772 - Fix use of kwargs in
fit!((::LinearMixedModel): #772- user-specified
σis actually used, defaulting to existing value REMLdefaults to model's already specified REML value.
- user-specified
- Clean up code of keyword convenience constructor for
OptSummary. #772 - Refactor thresholding parameters for forcing near-zero parameter values into
OptSummary. #772
- Re-export accidentally dropped export
lrtest. #769
- Properties for
GeneralizedLinearMixedModelnow default to delegation to the internal weightedLinearMixedModelwhen that property is not explicitly handled byGeneralizedLinearMixedModel. Previously, properties were delegated on an explicit basis, which meant that they had to be added manually as use cases were discovered. The downside to the new approach is that it is now possible to access properties whose definition in the LMM case doesn't match the GLMM definition when the GLMM definition hasn't been explicitly been implemented. #767
- Fix for
simulate!when only the estimable coefficients for a rank-deficient model are provided. #756 - Improve handling of rank deficiency in GLMM. #756
- Fix display of GLMM bootstrap without a dispersion parameter. #756
- Support for rank deficiency in the parametric bootstrap. #755
- Use
muladdwhere possible to enable fused multiply-add (FMA) on architectures with hardware support. FMA will generally improve computational speed and gives more accurate rounding. #740 - Replace broadcasted lambda with explicit loop and use
one. This may result in a small performance improvement. #738
- Switch to explicit imports from all included packages (i.e. replace
using Foobyusing Foo: Foo, bar, baz) #748 - Reset parameter values before a
deepcopyin a test (doesn't change test result) #744
- Comment out calls to
@debug#733 - Update package versions in compat and change
Aqua.test_allargument name #733
- Support for equal-tail confidence intervals for
MixedModelBootstrap. #715 - Basic
showmethods forMixedModelBootstrapandMixedModelProfile. #715 - The
hide_progresskeyword argument toparametricbootstrapis now deprecated. Users should instead useprogress(which is consistent with e.g.fit). #717
- Auto apply
Grouping()to grouping variables that don't already have an explicit contrast. #652
- The
.tblproperty of aMixedModelBootstrapnow includes the correlation parameters for lower triangular elements of theλfield. #702
- New method
StatsAPI.coefnames(::ReMat)returns the coefficient names associated with each grouping factor. #709
- More user-friendly error messages when a formula contains variables not in the data. #707
- EXPERIMENTAL New kwarg
amalgamatecan be used to disable amalgation of random effects terms sharing a single grouping variable. Generally,amalgamate=falsewill result in a slower fit, but may improve convergence in some pathological cases. Note that this feature is experimental and changes to it are not considered breakings. #673 - More informative error messages when passing a
DistributionorLinktype instead of the desired instance. #698 - More informative error message on the intentional decision not to define methods for the coefficient of determination. #698
- EXPERIMENTAL Return
finitialwhen PIRLS drifts into a portion of the parameter space that yields a (numerically) invalid covariance matrix. This recovery strategy may be removed in a future release. #616
- Support for check tolerances in deserialization. #703
- Support for different optimization criteria during the bootstrap. #694
- Support for combining bootstrap results with
vcat. #694 - Support for saving and restoring bootstrap replicates with
savereplicatesandrestorereplicates. #694
- New function
profilefor computing likelihood profiles forLinearMixedModel. The resultantMixedModelProfilecan be then be used for computing confidence intervals withconfint. Note that this API is still somewhat experimental and as such the internal storage details ofMixedModelProfilemay change in a future release without being considered breaking. #639 - A
confint(::LinearMixedModel)method has been defined that returns Wald confidence intervals based on the z-statistic, i.e. treating the denominator degrees of freedom as infinite. #639
raneftablesreturns aNamedTuplewhere the names are the grouping factor names and the values are someTables.jl-compatible type. This type has been changed to aTablefromTypedTables.jl. #682
- Precompilation is now handled with
PrecompileToolsinstead ofSnoopPrecompile. #681 - An unnecessary explicit
Varargin an internal method has been removed. This removal eliminates a compiler warning about the deprecatedVarargpattern. #680
- The pirated method
Base.:/(a::AbstractTerm, b::AbstractTerm)is no longer defined. This does not impact the use of/as a nesting term in@formulawithin MixedModels, only the programmatic runtime construction of formula, e.g.term(:a) / term(:b). If you requireBase.:/, thenRegressionFormulae.jlprovides this method. (Avoiding method redefinition when usingRegressionFormulae.jlis the motivating reason for this change.) #677
raneftablesreturns aNamedTuplewhere the names are the grouping factor names and the values are someTables.jl-compatible type. Currently this type is aDictTablefromTypedTables.jl. #634
- Rank deficiency in prediction is now supported, both when the original model was fit to rank-deficient data and when the new data are rank deficient. The behavior is consistent but may be surprising when both old and new data are rank deficient. See the
predictdocstring for an example. #676 - Multithreading in
parametricbootstrapwithuse_threadsis now deprecated and a noop. With improvements in BLAS threading, multithreading at the Julia level did not help performance and sometimes hurt it. #674
- Support
StatsModels0.7, drop support forStatsModels0.6. #664 - Revise code in benchmarks to work with recent Julia and PkgBenchmark.jl #667
- Julia minimum compat version raised to 1.8 because of BSplineKit #665
- Use
SnoopPrecompilefor better precompilation performance. This can dramatically increase TTFX, especially on Julia 1.9. #663
- Don't fit a GLM internally during construction of GLMM when the fixed effects are empty (better compatibility with
dropcollinearkwarg in newer GLM.jl) #657
- Allow predicting from a single observation, as long as
Grouping()is used for the grouping variables. The simplified implementation ofGrouping()also removes several now unnecessaryStatsModelsmethods that should not have been called directly by the user. #653
- More informative error message for formulae lacking random effects #651
- Replace separate calls to
copyto!andscaleinflate!inupdateL!withcopyscaleinflate!#648
- Avoid repeating initial objective evaluation in
fit!method forLinearMixedModel - Ensure that the number of function evaluations from NLopt corresponds to
length(m.optsum.fitlog) whenisone(thin)`. #637
- Relax type restriction for filename in
saveoptsumandrestoreoptsum!. Users can now pass any type with an appropriateopenmethod, e.g.<:AbstractPath. #628
- Attempt recovery when the initial parameter values lead to an invalid covariance matrix by rescaling #615
- Return
finitialwhen the optimizer drifts into a portion of the parameter space that yields a (numerically) invalid covariance matrix #615
- Support transformed responses in
predict#614 - Simplify printing of BLAS configuration in tests. #597
- Add precompile statements to speed up first
LinearMixedModeland BernoulliGeneralizedLinearModelfit #608
- Efficiency improvements in
predict, both in memory and computation #604 - Changed the explanation of
predict's keyword argumentnew_re_levelsin a way that is clearer about the behavior when there are multiple grouping variables. #603 - Fix the default behavior of
new_re_levels=:missingto match the docstring. Previously, the default was:population, in disagreement with the docstring. #603
- Loosen type restriction on
shortestcovint(::MixedModelBootstrap)toshortestcovint(::MixedModelFitCollection). #598
- Experimental support for initializing
GeneralizedLinearMixedModelfits from a linear mixed model instead of a marginal (non-mixed) generalized linear model. #588
- Allow constructing a
GeneralizedLinearMixedModelwith constant response, but don't update theLmatrix nor initialize its deviance. This allows for the model to still be used for simulation where the response will be changed before fitting. #578 - Catch
PosDefExceptionduring the first optimization step and throw a more informativeArgumentErrorif the response is constant. #578
- Fix type parameterization in MixedModelsBootstrap to support models with a mixture of correlation structures (i.e.
zerocorrin some but not all RE terms) #577
- Add a constructor for the abstract type
MixedModelthat delegates toLinearMixedModelorGeneralizedLinearMixedModel. #572 - Compat for Arrow.jl 2.0 #573
- Add support for storing bootstrap results with lower precision #566
- Improved support for zerocorr models in the bootstrap #570
- Add support for zerocorr models to the bootstrap #561
- Add a
Base.length(::MixedModelsFitCollection)method #561
- Add support for specifying a fixed value of
σ, the residual standard deviation, inLinearMixedModel.fittakes a keyword-argumentσ.fit!does not exposeσ, butσcan be changed after model construction by settingoptsum.sigma. #551 - Add support for logging the non-linear optimizer's steps via a
thinkeyword-argument forfitandfit!. The default behavior is 'maximal' thinning, such that only the initial and final values are stored.OptSummaryhas a new fieldfitlogthat contains the aforementioned log as a vector of tuples of parameter and objective values.#552 - Faster version of
leverageforLinearMixedModelallowing for experimentation using the sum of the leverage values as an empirical degrees of freedom for the model. #553, see also #535 - Optimized version of
condVarwith an additional method for extracting only the conditional variances associated with a single grouping factor. #545
- Drop dependency on
BlockArraysand use aVectorof matrices to represent the lower triangle in packed, row-major order. The non-exported functionblockcan be used for finding the correspondingVectorindex of a block. #456 simulate!now marks the modified model as being unfitted.- Deprecated and unused
namedargument removed fromranef#469 - Introduce an abstract type for collections of fits
MixedModelFitCollection, and makeMixedModelBootstrapa subtype of it. Accordingly, rename thebstrfield tofits. #465 - The response (dependent variable) is now stored internally as part of the
the renamed
FeMatfield, now calledXymat#464 - Replace internal
statscholeskyandstatsqrfunctions for determining the rank ofXbystatsrank. #479 - Artifacts are now loaded lazily: the test data loaded via
datasetis downloaded on first use #486 ReMatandPCAnow support covariance factors (λ) that areLowerTriangularorDiagonal. This representation is both more memory efficient and enables additional computational optimizations for particular covariance structures.#489GeneralizedLinearMixedModelnow includes the response distribution as one of its type parameters. This will allow dispatching on the model family and may allow additional specialization in the future.#490saveoptsumandrestoreoptsum!provide for saving and restoring theoptsumfield of aLinearMixedModelas a JSON file, allowing for recreating a model fit that may take a long time for parameter optimization. #506- Verbose output now uses
ProgressMeter, which gives useful information about the timing of each iteration and does not flood stdio. Theverboseargument has been renamedprogressand the default changed totrue. #539 - Support for Julia < 1.6 has been dropped. #539
- New
simulate,simulate!andpredictmethods for simulating and predicting responses to new data. #427
- It is now possible to construct
RandomEffectsTerms at run-time fromTerms (methods forBase.|(::AbstractTerm, ::AbstractTerm)added) #470 RandomEffectsTerms can have left- and right-hand side terms that are "non-concrete", andapply_schema(::RandomEffectsTerm, ...)works more like other StatsModels.jlAbstractTerms #470- Methods for
Base./(::AbstractTerm, ::AbstractTerm)are added, allowing nesting syntax to be used withTerms at run-time as well #470
- Add support for NLopt
maxtimeoption toOptSummary#524
- Add support for
condVarfor models with a BlockedSparse structure #523
- Add
condVarandcondVartablesfor computing the conditional variance on the random effects #492 - Bugfix: store the correct lower bound for GLMM bootstrap, when the original model was fit with
fast=false#518
- Add
likelihoodratiotestmethod for comparing non-mixed (generalized) linear models to (generalized) linear mixed models #508.
- Explicitly deprecate vestigial
namedkwarg inranefin favor ofraneftables#507.
- Fix MIME show methods for models with random-effects not corresponding to a fixed effect #501.
- The Progressbar for
parametricbootstrapandreplicateis not displayed when in a non-interactive (i.e. logging) context. The progressbar can also be manually disabled withhide_progress=true.#495 - Threading in
parametricbootstrapnow uses aSpinLockinstead of aReentrantLock. This improves performance, but care should be taken when nesting spin locks. #493 - Single-threaded use of
paramatricbootstrapnow works when nested within a larger multi-threaded context (e.g.Threads.@threads for). (Multi-threadedparametricbootstrapworked and continues to work within a nested threading context.) #493
- The value of a named
offsetargument toGeneralizedLinearMixedModel, which previously was ignored #453, is now handled properly. #482
shortestcovintmethod forMixedModelsBootstrap#484
- HTML and LaTeX
showmethods forMixedModel,BlockDescription,LikelihoodRatioTest,OptSummaryandVarCorr. Note that the interface for these is not yet completely stable. In particular, rounding behavior may change. #480
- Markdown
showmethods forMixedModel,BlockDescription,LikelihoodRatioTest,OptSummaryandVarCorr. Note that the interface for these is not yet completely stable. In particular, rounding behavior may change. White-space padding within Markdown may also change, although this should not impact rendering of the Markdown into HTML or LaTeX. The Markdown presentation of aMixedModelis much more compact than the REPL summary. If the REPL-style presentation is desired, then this can be assembled from the Markdown output fromVarCorrandcoeftable#474.
- [experimental] Additional convenience constructors for
LinearMixedModel#449
- Compatibility updates
rankUpdate!method forUniformBlockDiagonalbyDense#447
- Compatibility updates
rankUpdate!method forDiagonalbyDense#446- use eager (install-time) downloading of
TestDataartifact to avoid compatibility issues withLazyArtifactsin Julia 1.6 #444
- Compatibility updates
- Better
loglikelihood(::GeneralizedLinearMixedModel)which will work for models with dispersion parameters #419. Note that fitting such models is still problematic.
simulate!and thusparametricbootstrapmethods forGeneralizedLinearMixedModel#418.- Documented inconsistent behavior in
sdestandvarestGeneralizedLinearMixedModel#418.
- Compatibility updates
- Minor updates for formatting in various
showmethod forVarCorr.
- Nested grouping factors can be written using the
/notation, as in@formula(strength ~ 1 + (1|batch/cask))as a model for thepastesdataset. - The
zerocorrfunction converts a vector-valued random effects term from correlated random effects to uncorrelated. (See theconstructorssection of the docs.) - The
fulldummyfunction can be applied to a factor to obtain a redundant encoding of a categorical factor as a complete set of indicators plus an intercept. This is only practical on the left-hand side of a random-effects term. (See theconstructorssection of the docs.) Grouping()can be used as a contrast for a categorical array in thecontrastsdictionary. Doing so bypasses creation of contrast matrix, which, when the number of levels is large, may cause memory overflow. As the name implies, this is used for grouping factors. #339
- Checks for rank deficiency in the model matrix for the fixed-effects parameters have been improved.
- The distinction between
coef, which always returns a full set of coefficients in the original order, andfixef, which returns possibly permuted and non-redundant coefficients, has been made consistent across models.
- The
parametricbootstrapfunction and the struct it produces have been extensively reworked for speed and convenience. See thebootstrapsection of the docs.
- The PCA property for
MixedModeltypes provides principal components from the correlation of the random-effects distribution (as opposed to the covariance) - Factor loadings are included in the
printmethod for thePCAstruct.
- An
AbstractReMattype has now been introduced to support #380 work on constrained random-effects structures and random-effects structures appropriate for applications in GLM-based deconvolution as used in fMRI and EEG (see e.g. unfold.jl.) - Similarly, a constructor for
FeMat{::SparseMatrixCSC,S}has been introduced #309. Currently, this constructor assumes a full-rank matrix, but the work on rank deficiency may be extended to this constructor as well. - Analogous to
AbstractReMat, anAbstractReTerm <: AbstractTermtype has been introduced #395. Terms created withzerocorrare of typeZeroCorr <: AbstractReTerm.
- Several data sets from the literature were previously saved in
.rdaformat in thetestdirectory and read using theRDatapackage. These are now available in anArtifactin theArrowformat #382. - Call
MixedModels.datasets()to get a listing of the names of available datasets - To load, e.g. the
dyestuffdata, useMixedModels.dataset(:dyestuff) - Data sets are loaded using
Arrow.Tablewhich returns a column table. Wrap the call inDataFrameif you prefer aDataFrame. - Data sets are cached and multiple calls to
MixedModels.dataset()for the same data set have very low overhead after the first call.
describeblockshas been dropped in favor of theBlockDescriptiontype- The
namedargument toranefhas been dropped in favor ofraneftables