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

Fit switchpoint model with all colonies and covariates (rework bumbl() internals) #58

Open
Aariq opened this issue Feb 16, 2021 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@Aariq
Copy link
Owner

Aariq commented Feb 16, 2021

In the case of a dataset of bumblebee worker count over time with possible covariates, we want to estimate different values of tau (the switchpoint) for each colony, but a single value for each covariate (or variance parameter like in a negative binomial model).

The current behavior is to fit as many models as there are colonies to find tau. You could do this with a simple formula, count ~ week supplied to the current version of bumbl(), and then take the resulting tau's and plug them into a model with covariates using all the data. However, the value of tau might depend on covariates or variance parameters.

Elizabeth thinks the solution is to optimize values of tau for all colonies simultaneously (e.g. with optim()) to maximize likelihood of a model including covariates fit to all the data.

I think this involves fitting a model like count ~ time*colony + .post*colony + covariates where .post is 0 before tau and time-tau after tau. The goal would be to optimize the values of tau for each colony to maximize the likelihood of that GLM.

@Aariq Aariq added the enhancement New feature or request label Feb 16, 2021
@Aariq Aariq added this to the v1.0.0 milestone Feb 17, 2021
@Aariq Aariq modified the milestones: v1.0.0, v2.0.0 Mar 16, 2021
@Aariq
Copy link
Owner Author

Aariq commented Apr 14, 2021

This should possibly exist as a separate function for backwards compatibility (e.g. bumbl2())

@Aariq
Copy link
Owner Author

Aariq commented Jul 4, 2021

The insight package might be useful for manipulating model formulae https://github.com/easystats/insight

@Aariq
Copy link
Owner Author

Aariq commented Aug 9, 2021

A "sketch" of this rework is available here: https://github.com/Aariq/bumbl/blob/master/notes/single-model-rework-notes.Rmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant