Type: | Package |
Title: | Discrete Beta Regression |
Version: | 1.4.1 |
Date: | 2023-02-20 |
Description: | Bayesian Beta Regression, adapted for bounded discrete responses, commonly seen in survey responses. Estimation is done via Markov Chain Monte Carlo sampling, using a Gibbs wrapper around univariate slice sampler (Neal (2003) <doi:10.1214/aos/1056562461>), as implemented in the R package MfUSampler (Mahani and Sharabiani (2017) <doi:10.18637/jss.v078.c01>). |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Depends: | R (≥ 3.5.0) |
Imports: | MfUSampler, methods, coda |
NeedsCompilation: | no |
Packaged: | 2023-02-20 19:43:28 UTC; ec2-user |
Author: | Alireza Mahani [cre, aut], Mansour Sharabiani [aut], Alex Bottle [aut], Cathy Price [aut] |
Maintainer: | Alireza Mahani <alireza.s.mahani@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-02-20 23:40:06 UTC |
Summary, print, plot and coef methods for Discretised Beta Regression Fits
Description
Summary, print, plot and coef methods for Discretised Beta Regression Fits
Usage
## S3 method for class 'dbr'
coef(
object
, prob = c(0.025, 0.5, 0.975)
, ...
)
## S3 method for class 'dbr'
print(
x
, ...
)
## S3 method for class 'dbr'
summary(
object
, context
, make_plot = TRUE
, ...
)
## S3 method for class 'dbr'
plot(x, ...)
Arguments
object |
Result of call to |
x |
Result of call to |
prob |
Vector of probabilities at which to calculate the posterior quantiles of model parameters. |
make_plot |
Whether to generate the context-dependent plots in the |
context |
Dataframe with a single row, containing all columns needed for prediction. These values are used for producing pseudo-coefficient plots in the |
... |
Further arguments passed to the functions. |
Value
For coef
, a 2D array of size length(prob)
x nVar
, where nVar
is the number of model parameters. The latter itself is composed of left and right buffers, precision parameter of beta distribution, and covariate coefficients. Note that if left and/or right buffers were not estimated by dbr
, their confidence interval will be identical to the point estimate. The print
method prints the formula used to call dbr
.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
Examples
library("DBR")
data("pain")
est <- dbr(
interference ~ severity + age
, pain
, control = dbr.control(
nsmp = 50
, nburnin = 25
)
)
print(est)
plot(est)
coef(est, prob = c(0.05, 0.5, 0.95))
summary(est, context = pain[2, ])
Utility function to call MCMC diagnostic functions in the coda package
Description
Utility function to call MCMC diagnostic functions in the coda package
Usage
coda_wrapper(dbr_obj, coda_function, ...)
Arguments
dbr_obj |
An object of class |
coda_function |
A function in the coda package, with first argument being an |
... |
Arguments to be passed to |
Value
The output of coda_function
.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
Examples
library("DBR")
library("coda")
data("pain")
est <- dbr(
interference ~ severity + age
, pain
, control = dbr.control(
nsmp = 50
, nburnin = 25
)
)
coda_wrapper(est, autocorr, lag = c(0, 5))
Discretised Beta Regression for Survey-Response Analysis
Description
Discretised Beta Regression for Survey-Response Analysis
Usage
dbr(
formula
, data
, control = dbr.control()
, yunique = NULL
, wghts = rep(1, nrow(data))
)
dbr.control(
nsmp = 100
, nburnin = 50
, estimate_left_buffer = FALSE
, estimate_right_buffer = FALSE
, buffer_max = 5.0
)
Arguments
formula |
Standard |
data |
Data frame containing response and predictors as described in |
control |
List of parameters for controlling the MCMC estimation. |
yunique |
Vector of values/levels that the response variable can assume. If not specified, this will be extracted from the |
wghts |
Vector of weights to be applied during model estimation. Default is a uniform weight vector. |
nsmp |
Number of MCMC samples to collect, including the burnin phase. |
nburnin |
Number of initial MCMC samples to discard before calculating parameter estimates. |
estimate_left_buffer |
Boolean flag indicating whether to estimate a left buffer from the data. |
estimate_right_buffer |
Boolean flag indicating whether to estimate a right buffer from the data. |
buffer_max |
Maximum size of left/right buffer, only used if above flags are set to TRUE. |
Value
An object of class dbr
, which is a list containing the following fields:
formula |
Same as input. |
control |
Same as input. |
yunique |
Same as input. |
wghts |
Same as input. |
est |
An internal object containing estimation results. Should not be accessed directly by user. Use |
data |
Same as input. |
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
See Also
Examples
library("DBR")
data("pain")
est <- dbr(
interference ~ severity + age
, pain
, control = dbr.control(
nsmp = 50
, nburnin = 25
)
)
Pain Data
Description
Based on a survey of nearly 10,000 patients in UK health clinics during 2010-2014 to assess the quality of care they received.
Usage
data("pain")
Format
A data frame with 1318 observations on the following 3 variables.
severity
Average of 4 responses, each on a 0-10 scale (11 levels). They measure patients' perception of pain severity - over the 7 days leading up to the survey - at (1) its worst, (2) at its least, (3) on average, and (4) right now.
interference
Average of 7 scores, each on a 0-10 scale (11 levels). These questions measure - over the 7 days leading up to the survey - the level of interference of pain in patient's life along the following dimensions: (1) general activity, (2) mood, (3) walking ability, (4) normal work (outside of home and housework), (5) relations with other people, (6) sleep and (7) enjoyment of life.
age
Age of respondents, in years.
Predict method for Discretised Beta Regression Fits
Description
Predict method for Discretised Beta Regression Fits
Usage
## S3 method for class 'dbr'
predict(
object
, newdata = NULL
, type = c("sample", "point")
, ...
)
Arguments
object |
Standard |
newdata |
Data frame containing the predictors, matching the |
type |
Whether to make point predictions or generate sample from the predictive distribution. |
... |
Further arguments passed to or from other methods. |
Value
If type
is 'point', this will be a vector of same length as nrow(newdata)
, with unique values consistent with the dbr
call. If type
is 'sample', this will be a 2D array of size nrow(data)
x nsmp
.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
Examples
## Not run:
library("DBR")
data("pain")
est <- dbr(
interference ~ severity + age
, pain
, control = dbr.control(
nsmp = 200
, nburnin = 100
)
)
predict(est, type = "point")
## End(Not run)