sim.train.test: Simulate in-sample and out-of-sample deviance

Description Usage Arguments Details Author(s)

Description

Simulates posterior observations for map and map2stan model fits.

Usage

1
2
sim.train.test( N=20 , k=3 , rho=c(0.15,-0.4) , b_sigma=100 , 
    DIC=FALSE , WAIC=FALSE, devbar=FALSE , devbarout=FALSE )

Arguments

N

Number of cases in simulated data

k

Number of parameters in model to fit to data

rho

Vector of correlations between predictors and outcome, in simulated data

b_sigma

Standard deviation of beta-coefficient priors

DIC

If TRUE, returns DIC

WAIC

If TRUE, returns WAIC

devbar

If TRUE, returns the average deviance in-sample

devbarout

If TRUE, returns average deviance out-of-sample

Details

This function simulates Gaussian data and then fits linear regression models to it, returning the deviance of the fit (training, in-sample) and the deviance on a new sample, computed using the MAP estimates from the training sample.

Author(s)

Richard McElreath


joepowers16/rethinking documentation built on June 2, 2019, 6:52 p.m.