addition-terms | R Documentation |
Provide additional information on the response variable
in brms models, such as censoring, truncation, or
known measurement error. Detailed documentation on the use
of each of these functions can be found in the Details section
of brmsformula
(under "Additional response information").
resp_se(x, sigma = FALSE)
resp_weights(x, scale = FALSE)
resp_trials(x)
resp_thres(x, gr = NA)
resp_cat(x)
resp_dec(x)
resp_bhaz(gr = NA, df = 5, ...)
resp_cens(x, y2 = NA)
resp_trunc(lb = -Inf, ub = Inf)
resp_mi(sdy = NA)
resp_index(x)
resp_rate(denom)
resp_subset(x)
resp_vreal(...)
resp_vint(...)
x |
A vector; Ideally a single variable defined in the data (see
Details). Allowed values depend on the function: |
sigma |
Logical; Indicates whether the residual standard deviation
parameter |
scale |
Logical; Indicates whether weights should be scaled
so that the average weight equals one. Defaults to |
gr |
A vector of grouping indicators. |
df |
Degrees of freedom of baseline hazard splines for Cox models. |
... |
For |
y2 |
A vector specifying the upper bounds in interval censoring.
Will be ignored for non-interval censored observations. However, it
should NOT be |
lb |
A numeric vector or single numeric value specifying the lower truncation bound. |
ub |
A numeric vector or single numeric value specifying the upper truncation bound. |
sdy |
Optional known measurement error of the response treated as standard deviation. If specified, handles measurement error and (completely) missing values at the same time using the plausible-values-technique. |
denom |
A vector of positive numeric values specifying the denominator values from which the response rates are computed. |
These functions are almost solely useful when
called in formulas passed to the brms package.
Within formulas, the resp_
prefix may be omitted.
More information is given in the 'Details' section
of brmsformula
(under "Additional response information").
It is highly recommended to use a single data variable as input
for x
(instead of a more complicated expression) to make sure all
post-processing functions work as expected.
A list of additional response information to be processed further by brms.
brm
,
brmsformula
## Not run:
## Random effects meta-analysis
nstudies <- 20
true_effects <- rnorm(nstudies, 0.5, 0.2)
sei <- runif(nstudies, 0.05, 0.3)
outcomes <- rnorm(nstudies, true_effects, sei)
data1 <- data.frame(outcomes, sei)
fit1 <- brm(outcomes | se(sei, sigma = TRUE) ~ 1,
data = data1)
summary(fit1)
## Probit regression using the binomial family
n <- sample(1:10, 100, TRUE) # number of trials
success <- rbinom(100, size = n, prob = 0.4)
x <- rnorm(100)
data2 <- data.frame(n, success, x)
fit2 <- brm(success | trials(n) ~ x, data = data2,
family = binomial("probit"))
summary(fit2)
## Survival regression modeling the time between the first
## and second recurrence of an infection in kidney patients.
fit3 <- brm(time | cens(censored) ~ age * sex + disease + (1|patient),
data = kidney, family = lognormal())
summary(fit3)
## Poisson model with truncated counts
fit4 <- brm(count | trunc(ub = 104) ~ zBase * Trt,
data = epilepsy, family = poisson())
summary(fit4)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.