View source: R/modify_standata.R
modify_standata | R Documentation |
Modify Stan data to include left-censoring limits on predictor variables.
modify_standata(sdata, data, lcl, var_xcens, cens_ind)
sdata |
A list generated by |
data |
A dataframe containing the model variables. |
lcl |
A numeric vector of censoring limits for left-censored variables. Alternatively, a list of numeric vectors with censoring limits for
each variable and observation; the order should correspond to that of |
var_xcens |
A character vector containing the names of predictor variables with left-censoring; the order should
correspond to that of |
cens_ind |
A character vector containing the names of left-censoring indicators variables corresponding
to the contents of |
A list that can be passed to rstan::stan()
or cmdstanr::cmdstan_model
.
library("brms")
data <- read.csv(paste0(system.file("extdata", package = "bgamcar1"), "/data_gam.csv"))
data$f_cens <- ifelse(data$f < 5, "left", "none")
sdata <- make_standata(bf(y ~ f), data)
sdata_modified <- modify_standata(sdata, data, lcl = 5, var_xcens = "f", cens_ind = "f_cens")
str(sdata_modified)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.