Description Usage Arguments Details Value Additional parameters Author(s) References See Also Examples
This function implements four different algorithms to perform sequential sampling schemes for ABC. Sequential sampling schemes consist in sampling initially model parameters in the prior distribution, just like in a standard rejectionbased ABC, in order to obtain a rough posterior distribution of parameter values, and in subsequently sampling close to this rough posterior distribution to refine it. Sequential sampling schemes have been shown to be more efficient than standard rejectionbased procedures.
1 2 3 
method 
a character string indicating the sequential algorithm to be used. Possible values are 
model 
a 
prior 
a list of prior information. Each element of the list corresponds to a model parameter. The list element must be a vector whose first argument determines the type of prior distribution: possible values are 
nb_simul 
a positive integer equal to the desired number of simulations of the model below the tolerance threshold when 
summary_stat_target 
a vector containing the targeted (observed) summary statistics. 
prior_test 
a string expressing the constraints between model parameters.
This expression will be evaluated as a logical expression, you can use all the logical operators including 
n_cluster 
a positive integer. If larger than 1 (the default value), 
use_seed 
logical. If 
verbose 
logical. 
dist_weights 
a vector containing the weights to apply to the distance between the computed and the targeted statistics. These weights can be used to give more importance to a summary statistisc for example. The weights will be normalized before applying them. If not provided, no weights will be applied. 
... 
Additional arguments can be passed depending on the choosen method (see below) 
See the package's vignette for details on the four algorithms.
The returned value is a list containing the following components:
param 
The model parameters used in the 
stats 
The summary statistics obtained at the end of the 
weights 
The weights of the different 
stats_normalization 
The standard deviation of the summary statistics across the 
epsilon 
The final maximal distance between simulations and data in the retained sample of particles. 
nsim 
The number of 
computime 
The computing time to perform the simulations. 
intermediary 
Intermediary results stored when the option 
Depending on the choosen method, you can specify the following arguments:
a positive integer, the initial seed value provided to the function model
(if use_seed=TRUE
). This value is incremented by 1 at each call of the function model
.
logical used when method
is "Beaumont"
, "Lenormand"
or "Emulation"
. TRUE
by default.
If FALSE
, parameter sampling is not restricted to the initial ranges of the prior distribution during the subsequent algorithm steps.
a vector containing the sequence of tolerance thresholds when method
is "Beaumont"
, or the targeted final tolerance threshold when method
is "Drovandi"
.
a positive number between 0 and 1 (strictly) used when method
is "Drovandi"
, "Delmoral"
, "Lenormand"
or "Emulation"
.
alpha
is the proportion of particles rejected at each step in the algorithm "Drovandi"
.
This is the proportion of particles kept at each step in the algorithms "Delmoral"
, "Lenormand"
and "Emulation"
.
Default values are 0.5 when method
is "Drovandi"
, "Lenormand"
or "Emulation"
and 0.9 for "Delmoral"
.
See the package's vignette for details.
a positive number between 0 and 1 (strictly) used when method
is "Drovandi"
.
This is the expected proportion of particles which are going to be duplicated at each step.
Default value is 0.01.
See the package's vignette and Drovandi and Pettitt (2011) for details.
logical used when method
is "Drovandi"
.
Default value is TRUE
. In this case, the first tolerance threshold is determined by the algorithm, by taking the 1alpha
quantile of the distances between the simulated and targeted summary statistics.
If FALSE
, the initial tolerance threshold for the first step has to be provided as the first element of the vector tolerance_tab
. In this case, the targeted final tolerance threshold is the second element of tolerance_tab
.
a positive integer used when method
is "Delmoral"
.
This is the number of model
simulations performed for each parameter set.
Default value is 1. See the package's vignette and Del Moral et al. (2012) for details.
a positive integer used when method
is "Delmoral"
. Default value is 0.5*nb_simul
.
This is the minimal effective sample size below which a resampling step is launched. See the package's vignette and Del Moral et al. (2012) for details.
a positive number used when method
is "Delmoral"
.
This is the targeted final tolerance threshold.
a positive number between 0 and 1 (strictly) used when method
is "Lenormand"
or "Emulation"
.
This is the stopping criterion of the algorithm: a small number ensures a better convergence of the algorithm, but at a cost in computing time.
Default value is 0.05. See the package's vignette and Lenormand et al. (2012) for details.
a positive integer, the number of times the emulation is repeated. 9
by default.
a positive number, the number of design points selected for the local regression.
50
by default.
logical, FALSE
by default. If TRUE
, ABC_sequential
will output a bar of progression with the estimated remaining computing time. Option not available with multiple cores.
a positive number, the max number of fails when moving particle inside the prior. Enabled only if inside_prior is to TRUE
.
10000
by default.
Franck Jabot, Thierry Faure and Nicolas Dumoulin
Beaumont, M. A., Cornuet, J., Marin, J., and Robert, C. P. (2009) Adaptive approximate Bayesian computation. Biometrika,96, 983–990.
Del Moral, P., Doucet, A., and Jasra, A. (2012) An adaptive sequential Monte Carlo method for approximate Bayesian computation. Statistics and Computing, 22, 1009–1020.
Drovandi, C. C. and Pettitt, A. N. (2011) Estimation of parameters for macroparasite population evolution using approximate Bayesian computation. Biometrics, 67, 225–233.
Lenormand, M., Jabot, F., Deffuant G. (2012) Adaptive approximate Bayesian computation for complex models. http://arxiv.org/pdf/1111.1308.pdf
Jabot, F., Lagarrigues G., Courbaud B., Dumoulin N. (2015). A comparison of emulation methods for Approximate Bayesian Computation. To be published.
binary_model
, binary_model_cluster
, ABC_rejection
, ABC_emulation
, ABC_mcmc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166  ## Not run:
##### EXAMPLE 1 #####
#####################
set.seed(1)
## artificial example to show how to use the 'ABC_sequential' function.
## defining a simple toy model:
toy_model<function(x){ 2 * x + 5 + rnorm(1,0,0.1) }
## define prior information
toy_prior=list(c("unif",0,1)) # a uniform prior distribution between 0 and 1
## define the targeted summary statistics
sum_stat_obs=6.5
## to perform the Beaumont et al. (2009)'s method:
##
tolerance=c(1.5,0.5)
ABC_Beaumont<ABC_sequential(method="Beaumont", model=toy_model, prior=toy_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, tolerance_tab=tolerance)
ABC_Beaumont
## to perform the Drovandi and Pettitt (2011)'s method:
##
tolerance=0.5
c_drov=0.7
ABC_Drovandi<ABC_sequential(method="Drovandi", model=toy_model, prior=toy_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, tolerance_tab=tolerance, c=c_drov)
ABC_Drovandi
## to perform the Del Moral et al. (2012)'s method:
##
alpha_delmo=0.5
tolerance=0.5
ABC_Delmoral<ABC_sequential(method="Delmoral", model=toy_model, prior=toy_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, alpha=alpha_delmo, tolerance_target=tolerance)
ABC_Delmoral
## to perform the Lenormand et al. (2012)'s method:
##
pacc=0.4
ABC_Lenormand<ABC_sequential(method="Lenormand", model=toy_model, prior=toy_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, p_acc_min=pacc)
ABC_Lenormand
##### EXAMPLE 2 #####
#####################
## this time, the model has two parameters and outputs two summary statistics.
## defining a simple toy model:
toy_model2<function(x){ c( x[1] + x[2] + rnorm(1,0,0.1) , x[1] * x[2] + rnorm(1,0,0.1) ) }
## define prior information
toy_prior2=list(c("unif",0,1),c("normal",1,2))
# a uniform prior distribution between 0 and 1 for parameter 1, and a normal distribution
# of mean 1 and standard deviation of 2 for parameter 2.
## define the targeted summary statistics
sum_stat_obs2=c(1.5,0.5)
## to perform the Beaumont et al. (2009)'s method:
##
tolerance=c(1.5,0.5)
ABC_Beaumont<ABC_sequential(method="Beaumont", model=toy_model2, prior=toy_prior2,
nb_simul=20, summary_stat_target=sum_stat_obs2, tolerance_tab=tolerance)
ABC_Beaumont
## to perform the Drovandi and Pettitt (2011)'s method:
##
tolerance=0.5
c_drov=0.7
ABC_Drovandi<ABC_sequential(method="Drovandi", model=toy_model2, prior=toy_prior2,
nb_simul=20, summary_stat_target=sum_stat_obs2, tolerance_tab=tolerance, c=c_drov)
ABC_Drovandi
## to perform the Del Moral et al. (2012)'s method:
##
alpha_delmo=0.5
tolerance=0.5
ABC_Delmoral<ABC_sequential(method="Delmoral", model=toy_model2, prior=toy_prior2,
nb_simul=20, summary_stat_target=sum_stat_obs2, alpha=alpha_delmo, tolerance_target=tolerance)
ABC_Delmoral
## to perform the Lenormand et al. (2012)'s method:
##
pacc=0.4
# Only uniform priors are supported for the method "Lenormand" (since it performs a Latin
# Hypercube sampling at the beginning):
toy_prior2=list(c("unif",0,1),c("unif",0.5,1.5))
# a uniform prior distribution between 0 and 1 for parameter 1, and a normal distribution of
# mean 1 and standard deviation of 1 for parameter 2.
ABC_Lenormand<ABC_sequential(method="Lenormand", model=toy_model2, prior=toy_prior2,
nb_simul=20, summary_stat_target=sum_stat_obs2, p_acc_min=pacc)
ABC_Lenormand
##### EXAMPLE 3 #####
#####################
## this time, the model is a C++ function packed into a R function  this time, the option
# 'use_seed' must be turned to TRUE.
n=10
## define prior information
trait_prior=list(c("unif",3,5),c("unif",2.3,1.6),c("unif",25,125),c("unif",0.7,3.2))
trait_prior
## define the targeted summary statistics
sum_stat_obs=c(100,2.5,20,30000)
## to perform the Beaumont et al. (2009)'s method:
##
tolerance=c(8,5)
ABC_Beaumont<ABC_sequential(method="Beaumont", model=trait_model, prior=trait_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, tolerance_tab=tolerance, use_seed=TRUE)
ABC_Beaumont
## to perform the Drovandi and Pettitt (2011)'s method:
##
tolerance=3
c_drov=0.7
ABC_Drovandi<ABC_sequential(method="Drovandi", model=trait_model, prior=trait_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, tolerance_tab=tolerance, c=c_drov,
use_seed=TRUE)
ABC_Drovandi
## to perform the Del Moral et al. (2012)'s method:
##
alpha_delmo=0.5
tolerance=3
ABC_Delmoral<ABC_sequential(method="Delmoral", model=trait_model, prior=trait_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, alpha=alpha_delmo,
tolerance_target=tolerance, use_seed=TRUE)
ABC_Delmoral
## to perform the Lenormand et al. (2012)'s method:
##
pacc=0.4
ABC_Lenormand<ABC_sequential(method="Lenormand", model=trait_model, prior=trait_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, p_acc_min=pacc, use_seed=TRUE)
ABC_Lenormand
##### EXAMPLE 4  Parallel implementations #####
################################################
## NB: the option use_seed must be turned to TRUE.
## For models already running with the option use_seed=TRUE, simply change
# the value of n_cluster:
sum_stat_obs=c(100,2.5,20,30000)
ABC_Lenormand<ABC_sequential(method="Lenormand", model=trait_model, prior=trait_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, p_acc_min=pacc, use_seed=TRUE, n_cluster=2)
ABC_Lenormand
## For other models, change the value of n_cluster and modify the model so that the
# first parameter becomes a seed information value:
toy_model_parallel<function(x){
set.seed(x[1])
2 * x[2] + 5 + rnorm(1,0,0.1) }
sum_stat_obs=6.5
ABC_Lenormand<ABC_sequential(method="Lenormand", model=toy_model_parallel, prior=toy_prior,
nb_simul=20, summary_stat_target=sum_stat_obs, p_acc_min=pacc, use_seed=TRUE, n_cluster=2)
ABC_Lenormand
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.