stage2(obs, param, sumstats, obspar = NULL, init.best, dsets = 100,
sumsubs = 1:ncol(sumstats), limit = length(sumsubs), do.only=NULL,
do.err = FALSE, final.dens = FALSE, ...)combmat) or a vector of indices into 1:nstats. See details.do.err=TRUE, obspar must be supplied.abc function).dsets simulated datasets closest to the oberved dataset as measured by the init.best subset of summaries.obspar is supplied and do.err=TRUE).do.only.nacc x npar x ndatasets giving the posterior sample for each observed dataset. Not returned if final.dens=FALSE.init.best set of summaries to determine the dsets simulated datasets which are closest (in Euclidean norm) to the observed dataset. Since the model parameters generating the summary statistics are known for these simulated datasets, for each candidate subset of summary statistics, we can compute the error under ABC inference for each of these datasets. The best subset of summary statistics is that which minimizes this (average) error over all dsets datasets.
# load example data:
data(coal)
data(coalobs)
param<-coal[,2]
simstats<-coal[,5:8]
# use matrix below just in case to preserve dimensions.
obsstats<-matrix(coalobs[1,5:8],nrow=1)
obsparam<-matrix(coalobs[1,1])
## Not run:
# tmp<-stage2(obsstats, param, simstats, init.bes=c(1,3), dsets = 10)
# tmp$best
# ## End(Not run)
Run the code above in your browser using DataLab