library(ordbetareg)
data('ord_fit_mean')
# use function to calculate probability of top end of scale
<- posterior_epred_ordbeta(ord_fit_mean,component="top")
pr_1s
# use function to calculate probability of bottom end of scale
<- posterior_epred_ordbeta(ord_fit_mean,component="top")
pr_0s
# use function to calculate probability of continuous /
# beta-distributed part of scale
<- posterior_epred_ordbeta(ord_fit_mean,component="top") pr_beta
Calculate Probability of Response Components
Description
This function is an alternative to the brms
default posterior_epred
to allow for predictions of the probability of the bottom, top, or middle (i.e. continuous) parts of the response. Useful when wanting to understand what the effect of a covariate is on bottom or top values of the scale.
Usage
## S3 method for class 'brmsfit'
posterior_epred_ordbeta(
object,
component = "all",
newdata = NULL,
re_formula = NULL,
re.form = NULL,
resp = NULL,
dpar = NULL,
nlpar = NULL,
ndraws = NULL,
draw_ids = NULL,
sort = FALSE,
...
)
Arguments
object
|
An ordbetareg/brms object |
component
|
The type of response component, i.e., the probability of the bottom end of the scale, the top end, or the middle (i.e.) continuous values. |
newdata
|
see brms::posterior_epred |
re_formula
|
see brms::posterior_epred |
re.form
|
see brms::posterior_epred |
resp
|
see brms::posterior_epred |
dpar
|
see brms::posterior_epred |
nlpar
|
see brms::posterior_epred |
ndraws
|
see brms::posterior_epred |
draw_ids
|
see brms::posterior_epred |
sort
|
see brms::posterior_epred |
…
|
see brms::posterior_epred |
Details
To predict the top, bottom, or "middle" (i.e. continuous) components of the response, set the component
argument to "top", "bottom" or "continuous". By default, component
is set to "all", which will replicate behavior of the default posterior_epred
function.
All other arguments besides component
are the same as the standard generic posterior_predict
. For more information on the relevant arguments for posterior_epred
, see brms::posterior_epred.
Value
An S x N matrix where S is the number of posterior draws and N is the number of observations.