Learn R Programming

EasyABC (version 1.0)

ABC_mcmc: Coupled to MCMC schemes for ABC

Description

This function implements three different algorithms to perform coupled to MCMC ABC.

Usage

ABC_mcmc(method, model, prior_matrix, n_obs, n_between_sampling, summary_stat_target, n_cluster = 1, ...)

Arguments

method
a character string indicating the ABC-MCMC algorithm to be used. Possible values are "Marjoram_original", "Marjoram" and "Wegmann". Note that the method "Marjoram_original" cannot be used with multiple
model
a R function implementing the model to be simulated. It must take as arguments an array containing a seed value (if use_seed=TRUE) and the model parameters and returning an array of summary statistics obtained at the end of the s
prior_matrix
a matrix or data frame containing the ranges of the prior distribution for each of the $p$ model parameters. It has $p$ lines and 2 columns. The first (second) column contains the lower (upper) bound of the prior distribution of the $p$ parameters.
n_obs
a positive integer equal to the desired number of sampled points along the MCMC.
n_between_sampling
a positive integer equal to the desired spacing between sampled points along the MCMC.
summary_stat_target
a vector containing the targeted (observed) summary statistics.
n_cluster
a positive integer. If larger than 1 (the default value), ABC_mcmc will launch model simulations in parallel on n_cluster cores of the computer.
...
Additional arguments can be passed depending on the choosen method (see below)

Value

  • The returned value is a list containing the following components:
  • paramThe model parameters used in the model simulations.
  • statsThe summary statistics obtained at the end of the model simulations.
  • distThe distance of the simulations to the data.
  • stats_normalizationThe standard deviation of the summary statistics across the model simulations of the initial step. These values are used to normalize the summary statistics before the computation of the Euclidean distance between simulations and data. If method is "Marjoram_original", this is equal to tab_normalization. If method is "Wegmann", this is not provided.
  • epsilonThe final maximal distance between simulations and data in the retained sample of particles.
  • nsimThe number of model simulations performed.
  • n_between_samplingThe spacing between two sampled points in the MCMC.
  • computimeThe computing time to perform the simulations.
  • min_statsThe minimal values of each summary statistics during the calibration step, given when method is "Wegmann".
  • max_statsThe maximal values of each summary statistics during the calibration step, given when method is "Wegmann".
  • lambdaThe lambda values of the Box-Cox transformation, given when method is "Wegmann".
  • geometric_meanThe geometric means, given when method is "Wegmann".
  • boxcox_meanThe means of Box-Cox transforms, given when method is "Wegmann".
  • boxcox_sdThe standard deviations of Box-Cox transforms, given when method is "Wegmann".
  • pls_transformThe matrix of PLS transformation, given when method is "Wegmann".
  • n_componentThe number of used components for the PLS transformation, given when method is "Wegmann".

Details

See the package's vignette for details on ABC-MCMC.

References

Marjoram, P., Molitor, J., Plagnol, V. and Tavar'e, S. (2003) Markov chain Monte Carlo without likelihoods. PNAS, 100, 15324--15328. Wegmann, D., Leuenberger, C. and Excoffier, L. (2009) Efficient approximate Bayesian computation coupled with Markov chain Monte Carlo without likelihood. Genetics, 182, 1207-1218.

See Also

binary_model, binary_model_cluster, ABC_rejection, ABC_sequential

Examples

Run this code
priormatrix=cbind(c(500,3,-2.3,1,-25,-0.7),c(500,5,1.6,1,125,3.2))
    sum_stat_obs=c(100,2.5,20,30000)
    n=10
    nbetweensampling=1
    distmax=8
    tabnormalization=c(50,1,20,10000)
    proposalrange=c(0,1,0.5,0,50,1)

    ## artificial example to perform the Marjoram et al. (2003)'s method.
    ##
    ABC_Marjoram_original<-ABC_mcmc(method="Marjoram_original", model=trait_model, prior_matrix=priormatrix,
    n_obs=n, n_between_sampling=nbetweensampling, summary_stat_target=sum_stat_obs, n_cluster=1, dist_max=distmax,
    tab_normalization=tabnormalization, proposal_range=proposalrange)
    ABC_Marjoram_original

    ## artificial example to perform the Marjoram et al. (2003)'s method, with modifications drawn from Wegmann et al. (2009) without Box-Cox and PLS transformations.
    ##
    ncalib=10
    tolquantile = 0.5
    ABC_Marjoram<-ABC_mcmc(method="Marjoram", model=trait_model, prior_matrix=priormatrix,
    n_obs=n, n_between_sampling=nbetweensampling, summary_stat_target=sum_stat_obs, n_cluster=1,
    n_calibration=ncalib, tolerance_quantile=tolquantile)
    ABC_Marjoram


    ## artificial example to perform the Wegmann et al. (2009)'s method.
    ##
    ABC_Wegmann<-ABC_mcmc(method="Wegmann", model=trait_model, prior_matrix=priormatrix,
    n_obs=n, n_between_sampling=nbetweensampling, summary_stat_target=sum_stat_obs, n_cluster=1,
    n_calibration=ncalib, tolerance_quantile=tolquantile)
    ABC_Wegmann

Run the code above in your browser using DataLab