`ApproxBayes.ABCRejection`

— Type`ABCRejection(sim_func::Function, nparams::Int64, ϵ::Float64, prior::Prior; <keyword arguments>)`

Create an ABCRejection type which will simulate data with sim*func. nparams is the number of parameters inputted into sim*func, ϵ is the target tolerance and prior sets the priors for the parameters. sim_func needs to take in 3 values, the parameters (in an array), constants (array) and target data in that order and needs to return 2 values, the first being the distance between the target data and simulated data and the second can be anything but is useful if for example you want to record some additional information about the simulations. ...

**Arguments**

`maxiterations = 10^5`

: Maximum number of samples before the ABC algorithm terminates.`constants = []`

: Any constants needed to simulate from sim_func`nparticles = 100`

: Number of particles (ie samples) of ABC algorithm

...

`ApproxBayes.ABCRejectionModel`

— Type`ABCRejectionModel(sim_func::Array{Function, 1}, nparams::Array{Int64, 1}, ϵ::Float64, prior::Array{Prior, 1}; <keyword arguments>)`

Create an ABCRejectionModel type which will create a type to run ABC with model selection. Each model is specified with a function, first input is an array of functions. nparams and priors are arrays for the number of parameters and priors for each model. each sim_func needs to take in 3 values, the parameters (in an array), constants (array) and target data in that order and needs to return 2 values, the first being the distance between the target data and simulated data and the second can be anything but is useful if for example you want to record some additional information about the simulations. ...

**Arguments**

`maxiterations = 10^5`

: Maximum number of samples before the ABC algorithm terminates.`constants = [[]]`

: Any constants needed to simulate from sim_func, needs to be an array of arrays, each one corresponding to a model function.`nparticles = 100`

: Number of particles (ie samples) of ABC algorithm

...

`ApproxBayes.ABCSMC`

— Type`ABCRejection(sim_func::Function, nparams::Int64, ϵT::Float64, prior::Prior; <keyword arguments>)`

Create an ABCSMC type which will simulate data with sim*func. nparams is the number of parameters inputted into sim*func, ϵT is the target tolerance and prior sets the priors for the parameters. sim_func needs to take in 3 values, the parameters (in an array), constants (array) and target data in that order and needs to return 2 values, the first being the distance between the target data and simulated data and the second can be anything but is useful if for example you want to record some additional information about the simulations. ...

**Arguments**

`maxiterations = 10^5`

: Maximum number of samples before the ABC algorithm terminates.`constants = []`

: Any constants needed to simulate from sim_func`nparticles = 100`

: Number of particles (ie samples) of ABC algorithm`α = 0.3`

: The αth quantile of population i is chosen as the ϵ for population i + 1`ϵ1 = 10^5`

: Starting ϵ for first ABC SMC populations`convergence = 0.05`

: ABC SMC stops when ϵ in population i + 1 is within 0.05 of populations i`kernel = uniformkernel`

: Parameter perturbation kernel, default is a uniform distribution.`gaussiankernel`

is also an option that is already available in ApproxBayes.jl. Alternatively you can code up your own kernel function. See kernels.jl for examples.

...

`ApproxBayes.ABCSMCModel`

— Type`ABCSMCModel(sim_func::Array{Function, 1}, nparams::Array{Int64, 1}, ϵT::Float64, prior::Array{Prior, 1}; <keyword arguments>)`

Create an ABCSMCModel type which will create a type to run the ABC SMC with model selection algorithm. Each model is specified with a function, first input is an array of functions. nparams and priors are arrays for the number of parameters and priors for each model, ϵT is the target tolerance. Each sim_func needs to take in 3 values, the parameters (in an array), constants (array) and target data in that order and needs to return 2 values, the first being the distance between the target data and simulated data and the second can be anything but is useful if for example you want to record some additional information about the simulations. ...

**Arguments**

`maxiterations = 10^5`

: Maximum number of samples before the ABC algorithm terminates.`constants = []`

: Any constants needed to simulate from sim_func`nparticles = 100`

: Number of particles (ie samples) of ABC algorithm`α = 0.3`

: The αth quantile of population i is chosen as the ϵ for population i + 1`ϵ1 = 10^5`

: Starting ϵ for first ABC SMC populations`convergence = 0.05`

: ABC SMC stops when ϵ in population i + 1 is within 0.05 of populations i`modelkern = 0.7`

: Probability model stays the same in model perturbation kernel, ie 70% of the time the model perturbation kernel will leave the model the same.

...

`ApproxBayes.Kernel`

— Type```
Kernel(perturbation_function::Function,
pdf_function::Function,
calculate_kernel_parameters::Function)
```

Create a parameter perturbation kernel. Required inputs are 3 functions. First is the `perturbation_function`

which should take 2 parameters, the parameter to be perturbed and any kernel specific parameter (for example the standard deviation of a normal distribution if this is the kernel of choice). Second function is the `pdf_function`

, that requires 4 inputs: 1) the newparticle 2) the old particle 3) kernel specific parameters and 4) an index i. The third function is `calculate_kernel_parameters`

which given an array of particles should calculate the kernel specific parameters for the next population. Should you wish to keep the same parameters throughout you can just write a function that returns a number(s).

`ApproxBayes.Prior`

— Type```
Prior(distributions)
Create Prior type for ABC algorithm specifying priors for each parameters. This is an array of Distribution types from Distribution.jl, each element corresponding to a parameter.
```

`ApproxBayes.runabc`

— Method`runabc(ABCsetup::ABCtype, targetdata; progress = false, verbose = false, parallel = true)`

Run ABC with ABCsetup defining the algorithm and inputs to algorithm, targetdata is the data we wish to fit the model to and will be used as an input for the simulation function defined in ABCsetup. If progress is set to `true`

a progress meter will be shown. Inference will be run in parallel via multithreading if `parallel = true`

. The environmental variable JULIA*NUM*THREADS needs to be set prior to launching a julia session.

`ApproxBayes.runabc`

— Method`runabc(ABCsetup::ABCtype, targetdata; progress = false, verbose = false)`

When the SMC algorithms are used, a print out at the end of each population will be made if verbose = true.

`ApproxBayes.writeoutput`

— Method`writeoutput(results; <keyword arguments>)`

Write the results of an ABC inference to a text file. For model selection algorithms a text file with the parameters of each model will be written and a text file with model probabilities. ...

**Arguments**

`dir = ""`

: Directory where the text file will be written to.`file= ""`

: Filename to write to, default depends on the type of inference.

...