bbolker / bbmle

maximum likelihood estimation package
GNU General Public License v3.0
25 stars 13 forks source link

be smarter about recognizing formulas #24

Open bbolker opened 5 years ago

bbolker commented 5 years ago

Something like

mu_expr <- ~settlers*exp(-exp(alpha_log)*t)/
    (1+(exp(beta_log)*settlers*(1-exp(-exp(alpha_log)*t))/exp(alpha_log)))
mle_form <- as.formula(substitute(recruits~dnorm(mu,sd=exp(sd_log)),
                       list(mu=mu_expr[[2]])))
m <- mle2(mle_form, data=subdat, start=subpar1, method="BFGS")

(not reproducible!) doesn't work because the test (in bbmle:::gfun()) is

class(try(form <- as.formula(object@call$minuslogl)) != "formula"