dcpo_xvt: Cross-validation testing for DCPO

Description Usage Arguments Details Value Examples

View source: R/dcpo_xvt.R

Description

dcpo_xvt performs a single cross-validation test for DCPO

Usage

1
2
3
4
5
6
7
8
dcpo_xvt(
  dcpo_input,
  fold_number = 1,
  number_of_folds = 10,
  fold_seed = 324,
  chime = TRUE,
  ...
)

Arguments

dcpo_input

a data frame of survey items and marginals generated by DCPOtools::dcpo_setup

fold_number

an integer indicating the number of the fold to treated as test data in the current analysis

number_of_folds

an integer indicating the total number of folds

fold_seed

a seed for reproducibly randomly assigning observations to folds; when a complete set of k-fold cross-validations is to be performed, the same seed should be used for all

chime

play chime when complete?

...

arguments to be passed to rstan::stan. See dcpo.

Details

dcpo_xvt performs a single cross-validation test of a DCPO estimation. To perform a complete k-fold cross-validation, call it repeatedly, changing only the fold_number argument.

Value

a stanfit object

Examples

1
2
3
4
5
# Single cross-validation test with 25% test set
demsup_xvtest_25pct <- dcpo_xvt(demsup_data,
                           number_of_folds = 4,
                           iter = 300,
                           chains = 1) # 1 chain/300 iterations for example only; use defaults

DCPO documentation built on July 8, 2020, 7:03 p.m.