You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
optim()
requires a function with the parameter to be optimized as the first argument that returns some kind of score like log-likelihood. Consider usingoptim()
inside ofbrkpt()
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, ifbrkpt()
is called with no value oftau
supplied, it usesoptim()
to optimize tau, then re-fits model with that new function. Ifbrkpt()
is called with a value oftau
, then it skips the optimization step.related:
The text was updated successfully, but these errors were encountered: