Learn R Programming

brms (version 1.3.1)

mo: Monotonic Predictors in brms Models

Description

Monotonic Predictors in brms Models

Usage

mo(expr)

Arguments

expr
Expression containing predictors, for which monotonic effects should be estimated. For evaluation, R formula syntax is applied.

Details

For detailed documentation see help(brmsformula) as well as vignette("brms_monotonic").

This function is almost solely useful when called in formulas passed to the brms package.

See Also

brmsformula

Examples

Run this code
  
## Not run: 
# # generate some data
# income_options <- c("below_20", "20_to_40", "40_to_100", "greater_100")
# income <- factor(sample(income_options, 100, TRUE), 
#                  levels = income_options, ordered = TRUE)
# mean_ls <- c(30, 60, 70, 75)
# ls <- mean_ls[income] + rnorm(100, sd = 7)
# dat <- data.frame(income, ls)
# 
# # fit a simple monotonic model
# fit <- brm(ls ~ mo(income), data = dat)
# 
# # summarise the model
# summary(fit)
# plot(fit, N = 6)
# plot(marginal_effects(fit), points = TRUE)
# ## End(Not run) 
 

Run the code above in your browser using DataLab