predict.bayesbr: Prediction Method for 'bayesbr' Objects

Description Usage Arguments See Also Examples

View source: R/predict.bayesbr.R

Description

A function that informs various types of prediction through a beta regression by the Bayesian view.

Usage

1
2
3
4
## S3 method for class 'bayesbr'
predict(object, newdata = NULL, type = c("response", "link",
"precision", "variance", "quantile"), na.action=c("exclude",
"replace"),at = 0.5,...)

Arguments

object

an object of the class bayesbr, containing the list returned from the bayesbr function.

newdata

A data frame in which to look for variables with which to predict. If omitted, the original observations are used.

type

A character containing the types of predictions: if type is "response" the function will calculate fitted values for theta; if type is "link" the function will calculate the linear predictor for theta and zeta;if type is "precision" the function will calculate fitted values for zeta parameter;if type is "variance" the function will calculate fitted variances of response; if type is "quantile" the function will calculate fitted quantiles of theta values;

na.action

Characters provided or treatment used in NA values. If na.action is equal to exclude (default value), the row containing the NA will be excluded in all variables of the model. If na.action is equal to replace, the row containing the NA will be replaced by the average of the variable in all variables of the model.

at

numeric vector indicating the quantiles that will be informed by the function (only if type = "quantile"). Its default is 0.5.

...

further arguments passed to or from other methods.

See Also

bayesbr,residuals.bayesbr,pmse

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data("CarTask", package = "bayesbr")

bbr = bayesbr(probability~ NFCCscale,data=CarTask,
             iter = 100, mean_betas = c(1,1.2))

predict(bbr, type = "response")
predict(bbr, type = "link")
predict(bbr, type = "precision")
predict(bbr, type = "variance")
predict(bbr, type = "quantile", at = c(0.25, 0.5, 0.75))


df = data.frame(NFCCscale = rnorm(10,4,1.4))

predict(bbr, newdata = df, type = "response")
predict(bbr, newdata = df, type = "link")
predict(bbr, newdata = df, type = "precision")
predict(bbr, newdata = df, type = "variance")
predict(bbr, newdata = df, type = "quantile", at = c(0.25, 0.5, 0.75))

bayesbr documentation built on July 17, 2021, 1:07 a.m.