make_brmsformula {bayesnec} | R Documentation |
Expose the final brmsformula
Description
Checks the input formula according to
bayesnec
requirements and
expose the final brmsformula
which is to be fitted via
package brms.
Usage
make_brmsformula(formula, data)
Arguments
formula |
Either a |
data |
A |
Value
A named list
, with each element containing the
final brmsformula
to be passed to
brm
.
See Also
bayesnecformula
,
check_formula
Examples
library(bayesnec)
nec3param <- function(beta, nec, top, x) {
top * exp(-exp(beta) * (x - nec) *
ifelse(x - nec < 0, 0, 1))
}
data <- data.frame(x = seq(1, 20, length.out = 10), tr = 100, wght = c(1, 2),
group_1 = sample(c("a", "b"), 10, replace = TRUE),
group_2 = sample(c("c", "d"), 10, replace = TRUE))
data$y <- nec3param(beta = -0.2, nec = 4, top = 100, data$x)
# make one single model
f_1 <- "y | trials(tr) ~ crf(sqrt(x), \"nec3param\")"
make_brmsformula(f_1, data)
# make an entire class of models
f_2 <- y ~ crf(x, "ecx") + ogl(group_1) + pgl(group_2)
make_brmsformula(f_2, data)
[Package bayesnec version 2.1.2.0 Index]