Learn R Programming

ggmcmc (version 1.5.1.1)

linear: Simulated data for a continuous linear regression and its MCMC samples

Description

Simulate a dataset with one explanatory variable and one continuous outcome variable using (y ~ dnorm(mu, sigma); mu = beta[1] + beta[2] * X). The data loads three objects: the observed y values, a coda object containing simulated values from the posterior distribution of the intercept and slope of a linear regression, and a coda object containing simulated values from the posterior predictive distribution. The purpose of the dataset is only to show the possibilities of the ggmcmc package.

Usage

data(linear)

Arguments

Format

Three objects, namely:

s

A coda object containing posterior distributions of the intercept (beta[1]) and slope (beta[2]) of a linear regression with simulated data.

s.y.rep

A coda object containing simulated values from the posterior predictive distribution of the outcome of a linear regression with simulated data (y ~ N(mu, sigma); mu = beta[1] + beta[2] * X; y.rep ~ N(mu, sigma); where y.rep is a replicated outcome, originally missing data).

y

A numeric vector containing the observed values of the outcome in the linear regression with simulated data.

Examples

Run this code
# NOT RUN {
data(linear)
str(s)
str(s.y.rep)
str(y)
# }

Run the code above in your browser using DataLab