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

use optim() for finding optimal value of switchpoint #56

Closed
Aariq opened this issue Feb 5, 2021 · 1 comment · Fixed by #57
Closed

use optim() for finding optimal value of switchpoint #56

Aariq opened this issue Feb 5, 2021 · 1 comment · Fixed by #57
Labels
enhancement New feature or request

Comments

@Aariq
Copy link
Owner

Aariq commented Feb 5, 2021

optim() requires a function with the parameter to be optimized as the first argument that returns some kind of score like log-likelihood. Consider using optim() inside of brkpt() instead of iterating over meshpoints of tau to find value of tau that maximizes likelihood.

A new, lowest level function could be created that only takes a formula like size ~ time and a value for the switchpoint, tau, and fits the modified lm (with .post in the formula). Then, if brkpt() is called with no value of tau supplied, it uses optim() to optimize tau, then re-fits model with that new function. If brkpt() is called with a value of tau, then it skips the optimization step.

related:

@Aariq Aariq added the enhancement New feature or request label Feb 5, 2021
@Aariq
Copy link
Owner Author

Aariq commented Feb 5, 2021

optimize() is the single parameter version

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

Successfully merging a pull request may close this issue.

1 participant