Learn R Programming

bayescopulareg (version 0.1.3)

predict.bayescopulaglm: Predictive posterior sample from copula GLM

Description

Sample from the predictive posterior density of a copula generalized linear model regression

Usage

# S3 method for bayescopulaglm
predict(object, newdata, nsims = 1, ...)

Arguments

object

Result from calling bayescopulaglm

newdata

data.frame of new data

nsims

number of posterior draws to take. The default and minimum is 1. The maximum is the number of simulations in object

...

further arguments passed to or from other methods

Value

array of dimension c(n, J, nsims) of predicted values, where J is the number of endpoints

Examples

Run this code
# NOT RUN {
set.seed(1234)
n <- 100
M <- 1000

x <- runif(n, 1, 2)
y1 <- 0.25 * x + rnorm(100)
y2 <- rpois(n, exp(0.25 * x))

formula.list <- list(y1 ~ 0 + x, y2 ~ 0 + x)
family.list <- list(gaussian(), poisson())
data = data.frame(y1, y2, x)

## Perform copula regression sampling with default
## (noninformative) priors
sample <- bayescopulaglm(
  formula.list, family.list, data, M = M
)
predict(sample, newdata = data)

# }

Run the code above in your browser using DataLab