Skip to content
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

Conditional standard deviations of the random effects #141

Open
wants to merge 48 commits into
base: dev
Choose a base branch
from

Conversation

AndrewRidden-Harper
Copy link

These modifications make the conditional standard deviations of the random effects accessible. The output of the R code as.data.frame(ranef(model, condVar=TRUE)) is stored as an attribute of the Lmer object. While some columns of this dataframe were already accessible with other Lmer attributes, we preserve the entire dataframe as it may be useful to some users. This pull request includes a test and example use of this new feature.

ejolly and others added 30 commits December 9, 2022 16:33
* Store fits and residuals in Lm2 models. Also compute model r2 metrics

* Remove manual rhome set during dev

* lrt for lmer objects

Implement loglik ratio test analogous to the one implemented in lme4

* Fix pandas deprecated function

* Add BIC and deviance to lrt

Make output closer to lme4

* Match behaviour in R

Make sure npar are correct and other values are in the same order

* Format code with black

* Get correct AIC

AICTab in summary of an lmer fitted by REML gives the deviance, not the AIC.

* Add tests for lrt

For the moment, we use a static dump of the R output, as rpy2 seems to clash with pytest

* Add confint to test variances

* Add tests for confint

* Guard against using lrt for non Lmer models

* Temp fix for rpy2 3.5.1, but not until they fix #873 recursion error

* Bump rpy2 and pandas requirements

* Update dep versions code changes to address rpy2 deprecation warnings

* try fixing GA ci

* try fixing GA ci

* rename meta.yaml and bump numpy version

* try fixing GA ci

* try fixing GA ci

* remove deprecated future imports

* refactor code to pull out R<->Py conversion into a separate module and remove global conversion activators

* fix bug in saving confints

* fixes ejolly#88, ejolly#113

* add sklearn dependency

* initial implementation code

* use pytest fixtures for data loading

* complete working (basic) implementation of Logistic Regression

* logistic Lm estimate test against glm() in R

* add rpy2 back to requirements

* reorg workflow files to run tests only on each push/pr

* whoops remove dev branch ref

* Update Tests.yml

* try fixing GA ci

* try fixing GA ci

* try fixing GA ci

* install rpy2 from conda-forge instead of pip to see if rpy2 linking works on macos

* install rpy2 from conda-forge instead of pip to see if rpy2 linking works on macos

* try old optimizer for inverse_gaussian model

* comment out rfx only models that crash only on GA

* GA try continuing on expected failure

* fix up conda build

* fix ci

* Update Tests.yml

* Update Build.yml

* fix ci

* update meta.yaml for working local build

* Update Tests.yml

* store fits in logistic Lm and add support for .predict

* allow .predict to return probs or original scale vals. Fix bug in converting logits to probs in Lmer. Fixes ejolly#78"

* add sphinx to dev reqs and update changelog

* update gitignore

* refactor Lm a bit

Co-authored-by: Andrea Manica <am315@cam.ac.uk>
Allow to pass a seed to bootMer to allow for repeatable runs of confint.
@AndrewRidden-Harper AndrewRidden-Harper marked this pull request as draft July 5, 2024 01:10
@AndrewRidden-Harper AndrewRidden-Harper marked this pull request as ready for review July 5, 2024 01:10
@AndrewRidden-Harper
Copy link
Author

@ejolly Thanks for your efforts developing pymer4!

…nef_cond_std

# Conflicts:
#	.gitignore
#	conda/meta.yaml
#	docs/new.rst
#	pymer4/models/Lm.py
#	pymer4/models/Lm2.py
#	pymer4/models/Lmer.py
#	pymer4/tests/conftest.py
#	pymer4/tests/test_models.py
#	pymer4/tests/test_stats.py
#	pymer4/utils.py
#	requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants