semiauto.abc: Performs semi-automatic ABC based on summary statistics...

Description Usage Arguments Details Value Warning Author(s) References See Also Examples

View source: R/semiauto.abc.R

Description

Performs semi-automatic ABC based on summary statistics regression.

Usage

1
2
3
4
semiauto.abc(obs, param, sumstats, obspar=NULL, abcmethod = abc, 
saprop = 0.5, abcprop = 0.5, overlap = FALSE, satr = list(), 
plot = FALSE, verbose = TRUE, do.err = FALSE, final.dens = FALSE, 
errfn = rsse, ...)

Arguments

obs

(matrix of) observed summary statistics.

param

matrix of simulated model parameter values.

sumstats

matrix of simulated summary statistics.

obspar

optional observed parameters (for use to assess simulation performance).

abcmethod

a function to perform ABC inference, e.g. the abc function from package abc.

saprop

a proportion, denoting the proportion of simulated datasets with which to perform semi-automatic ABC regression.

abcprop

a proportion, denoting the proportion of simulated datasets with which to perform ABC using abcmethod.

overlap

a boolean value indicating whether the simulated datasets specified by saprop and abcprop are disjoint (overlap=FALSE) or not.

satr

a list of functions indicating transformations of the summary statistics sumstats. These must be *suitable* functions, and must each return a vector, matrix or array with the number of elements being a multiple of the rows of sumstats. See details and examples sections for more information

plot

When plot==TRUE, a plot of parameter values against fitted values is produced for each parameter as a side-effect. This is most useful when the number of parameters is reasonably small.

verbose

a boolean value indicating whether informative statements should be printed to screen.

do.err

a boolean value indicating whether the simulation error should be returned. Note: if do.err=TRUE, obspar must be supplied.

final.dens

a boolean value indicating whether the posterior sample should be returned.

errfn

an error function to assess ABC inference performance.

...

any other optional arguments to the ABC inference procedure (e.g. arguments to the abc function).

Details

This function is essentially a wrapper for saABC. See the details section of saABC for more details on the implementation. The argument satr can be almost anything sensible in function form, see Examples section for example specifications.

Value

A list with the following components:

err

simulation error (if obspar is supplied and do.err=TRUE).

post.sample

an array of dimension nacc x npar x ndatasets giving the posterior sample for each observed dataset. Not returned if final.dens=FALSE.

sainfo

A list with the following information about the semi-automatic ABC run:
saprop, abcprop ,overlap, satr. See arguments for more details.

Warning

The argument satr must be supplied with valid functions. Whilst there are checks, these are minimal, since doing sophisticated checks is quite difficult.

Author(s)

Matt Nunes and Dennis Prangle

References

Blum, M. G. B, Nunes, M. A., Prangle, D. and Sisson, S. A. (2013) A comparative review of dimension reduction methods in approximate Bayesian computation. Stat. Sci. 28, Issue 2, 189–208.

Fearnhead, P. and Prangle, D. (2012) Constructing summary statistics for approximate Bayesian computation: semi-automatic approximate Bayesian computation. J. R. Stat. Soc. B 74, Part 3, 1–28.

Nunes, M. A. and Prangle, D. (2016) abctools: an R package for tuning approximate Bayesian computation analyses. The R Journal 7, Issue 2, 189–205.

See Also

saABC, selectsumm

Examples

 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
data(coal)
data(coalobs)

param<-coal[,2]
simstats<-coal[,4:6]

# use matrix below just in case to preserve dimensions.

obsstats<-matrix(coalobs[1,4:6],nrow=1)
obsparam<-matrix(coalobs[1,1])

# perform semi-automatic ABC with summary statistics defined by 
# X, X^2,X^3,X^4:
# other alternative specifications for this could be:
# list(function(x){ cbind(x,x^2,x^3,x^4) })
# list(as.function(alist(x=,cbind(x,x^2,x^3)))) etc

tmp<-semiauto.abc(obsstats, param, simstats,tol=.01,method="rejection",
satr=list(function(x){outer(x,Y=1:4,"^")}))

tmp$sa.info

# both these functions may be problematic: 

## Not run: 
 tmp<-semiauto.abc(obsstats, param, simstats,tol=.01,method="rejection",
satr=list(unique,sum))

## End(Not run)

dennisprangle/abctools documentation built on July 21, 2018, 9:31 p.m.