-
Notifications
You must be signed in to change notification settings - Fork 161
flexSigma: Add structured covariance support #849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Merge branch 'master' into flexSigma
Merge remote flexSigma into local flexSigma
Merge branch 'master' into flexSigma
…indices to for d = 0 and d = 1.
- Replace split pathway with unified S4 system to enable mixed formulas (e.g., cs(x|g) + ar1(y|g)) - Route mkLmerDevfun through mkdevfun to support theta parameter transformation - Add compute_lambdat_x methods for optimizer-to-Cholesky parameter conversion - Store structured covariance metadata in rho environment for deviance function access - Fix UnstructuredCovariance start values to maintain lme4 compatibility
|
current status: latest tests and info about commits are in https://github.com/lme4/lme4/blob/flexSigma/misc/cs_tests.R It looks like |
|
correcting the transposition fixes a lot of problems but there are still test failures, beyond the tests that Greg introduced for his stuff (which we may want to skip temporarily) - may try to track these down tomorrow, hoping they may actually be minor. |
|
The Maybe it is blasphemous for me to say, but I don't see a real benefit of using Matrix classes in |
|
I commented out some of Greg's tests, fixed others, took out the |
|
I believe the test failure in (There was an apparently unnecessary/redundant re-ordering step which I've commented out for now, which un-breaks that test and doesn't appear to break anything else in |
|
Examples run OK now. Tests show 4 errors:
Oops - crossed up. |
|
Hmm, I thought I fixed the first one just now. Pull and try again? when running at test level 5 ( In addition to the test-summary reference value, I get a few problems in test-predict that are enabled at test level > 1: |
|
Yeah, after pulling and rebuilding, I no longer see the error from The I reproduce the errors from |
|
Finding the source of the differences in fitted values from reference values is going to take some more work. In theory the changes to the way unstructured models are built should result in identical problem set-up → identical solutions ... ??? |
Summary
Adds structured covariance support to lme4 with
cs(),ar1(), anddiag()syntax, matching glmmTMB functionality while maintaining lme4's Cholesky parameterization philosophy.New Features
cs(Days | Subject, hom = TRUE/FALSE)ar1(Days | Subject, hom = TRUE/FALSE)diag(Days | Subject, hom = TRUE/FALSE)Files Changed
Implementation:
R/covariance_structures.R- S4 covariance classes and methodsR/covariance-helpers.R- Utility functions and transformationsR/formula-dispatch.R- Formula parsing and S4 object creationR/modular.R- Integration with lFormula pipelineR/lmer.R- VarCorr system with structured covariance support - adds theta parameter truncation, bifurcated mkVarCorr processing (traditional vs S4 structure dispatch), and structured theta naming system (tnames).Tests:
tests/testthat/test-covariance_structures.R- Comprehensive structure tests for S4 classes (current version is not valid).Tasks
Ensure consistent Cholesky parameterization across all structures
compute_lambdat_xmethod dcompute_covariance_matrixmethodget_interpretable_parametersmethodget_start_valuesmethodcompute_inverse_covariance_matrixmethodVerify all testthat tests pass when running
devtools::test(), temporarily skippingtests/testthat/test-covariance_structures.R.Verify all tests pass when running
devtools::check()Covariance Structure Unit Testing & Validation
Verify all tests pass when running
devtools::check()with covariance structures tests not skippedVerify GitHub Actions CI passes with
[run ci]VarCorr Methods (
VarCorr()extracts correct variance-covariance informationAdd support for
glmer()Implement solution for cov struct information Issue #857
Validate covariance structure implementations against glmmTMB consistency check:
Documentation
Fix devfun2 to handle profiling for structured covariances matrices Issue #858
Print/Show Methods
show()methods display correct parameter summariesWrite integration tests
Ensure all computational methods are robust and efficient
chol()calls fromcompute_lambdat_xmethodssolve()call fromcompute_inverse_structured()helperAdd support for
nlmer()