Cross-validation vs. DIC using stack loss data

Aki Vehtari
2003-01-15

Code

Environment was Linux, Matlab 6.5, and WinBUGS 1.4beta (with Wine 20021219). See generic example for an example how to call WinBUGS in Windows. This probably works with any Matlab version 5.* or 6.* and Matlab part should not be hard to port to S or R. On request I can make respective Classic BUGS files available.

Model description for each residual model:

stacks1_bug.txt
BUGS model description for residual model 1 and full posterior
stacks2_bug.txt
BUGS model description for residual model 2 and full posterior
stacks3_bug.txt
BUGS model description for residual model 3 and full posterior
stacks4_bug.txt
BUGS model description for residual model 4 and full posterior
stacks5_bug.txt
BUGS model description for residual model 5 and full posterior
Model description for each residual model when doing cross-validation. These files are otherwise same as above, but they also do the computation for the test-data in the cross-validation folds:
stacks1cv_bug.txt
BUGS model description for residual model 1 and CV posterior
stacks2cv_bug.txt
BUGS model description for residual model 2 and CV posterior
stacks3cv_bug.txt
BUGS model description for residual model 3 and CV posterior
stacks4cv_bug.txt
BUGS model description for residual model 4 and CV posterior
stacks5cv_bug.txt
BUGS model description for residual model 5 and CV posterior
Other files:
stacks.dat
Original data in plain format, Matlab code makes the data files for cross-validation
stacks_in.txt
Init file in S-Plus format
stackstr_scr.txt
Part of the script file for WinBUGS (1.4 or better). Matlab code use this as part of the script file made for running models with full data. Change paths according your environment.
stackscv_scr.txt
Part of the script file for WinBUGS (1.4 or better). Matlab code use this as part of the script file made for running models with CV data. Change paths according your environment.
stacks.m
Matlab M-file for doing the cross-validation and figures. Change paths according your environment.
Above code uses these:
mat2bugs.m
Save Matlab variables in S-PLUS format for BUGS
bugs2mat.m
Read BUGS CODA output to Matlab structure
dirrand.m
Uniform Dirichlet random vectors
Alternatively all above files in one zip:
stackscv.zip
All above files in one zip.


Aki Vehtari
Last modified: 2003-08-19