postpr.cv4postpr(index, sumstat, postpr.out = NULL, nval, tols, method,
subset = NULL, kernel = "epanechnikov", numnet = 10, sizenet = 5, lambda
= c(0.0001,0.001,0.01), trace = FALSE, maxit = 500, ...)sumstat to indicate which row of
sumstat belong to which model."postpr", optional. If supplied, all arguments
passed to postpr are extracted from this object,
except for sumstat, index, and tols"rejection", "mnlogistic",
"neuralnet". See postpr for details.index and/or sumstat are taken as
FALSE.method is "loclinear" or "neuralnet". Defaults
to "epanechnikov". See density for detailsmethod is
"neuralnet". Defaults to 10. It indicates the number of times
the function nnet is called.nnet for more
details.method is "neuralnet". See nnet for more
details. By default, 0.0001, 0.001, or 0.01 is randomly chosen forTRUE switches on tracing the optimization of
nnet. Applies only when method is
"neuralnet".method is "neuralnet". See also
nnet.nnet."cv4postpr", which is a list with the following
elementspostpr for each tolerance
rates.nval*the number of
models, indicating which rows of sumstat were used as
validation values.model contains the model names,
and statistics.names the names of the summary statistics..Random.seed when cv4postpr is
called.postpr is called to
estimate the parameter(s). Ideally, we want nval to be equal to the number of simulations
for each model, however, this might take too much time. Users are
warned not to choose a too large number of simulations (especially
when the neural networks are used). Beware that the actual number of
cross-validation estimation steps that need to be performed is
nval*the number of models.
The arguments for the function postpr can be supplied in
two ways. First, simply give them as arguments when calling this
function, in which case postpr.out can be NULL. Second,
via an existing object of class "postpr", here
postpr.out. WARNING: when postpr.out is supplied, the
same sumstat and param objects have to be used as in the
original call to postpr. Column names of sumstat
and param are checked for match.
See summary.cv4postpr for calculating the prediction
error from an object of class "cv4postpr" and
plot.cv4postpr for visualizing the misclassification of
the models using barplots.
postpr, summary.cv4postpr, plot.cv4postprdata(human)
###Reduce the sample size of the simulations to reduce the running time.
###Do not do that with your own data!
ss<-c(1:1000,50001:51000,100001:101000)
cv.modsel <- cv4postpr(models[ss], stat.3pops.sim[ss,], nval=5, tols=c(.05,.1), method="rejection")
summary(cv.modsel)
plot(cv.modsel, names.arg=c("Bottleneck", "Constant", "Exponential"))Run the code above in your browser using DataLab