predict.bayescopulaglm: Predictive posterior sample from copula GLM

Description Usage Arguments Value Examples

View source: R/predict_bayescopulaglm.R

Description

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

Usage

1
2
## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)

bayescopulareg documentation built on Jan. 13, 2021, 8:04 a.m.