densityPlot: Plot the posterior density given a new summary statistic

View source: R/densityPlot.R

densityPlotR Documentation

Plot the posterior density given a new summary statistic

Description

Given a reg-ABC-RF object and a new value of the summary statistics, densityPlot gives the corresponding posterior density plot of the parameter, as well as the prior (in grey).

Usage

## S3 method for class 'regAbcrf'
densityPlot(object, obs, training,
add=TRUE, main="Posterior density", log="", xlim=NULL,
ylim=NULL, xlab=NULL, ylab=NULL, paral=FALSE,
ncores= if(paral) max(detectCores()-1,1) else 1, ...)

Arguments

object

a regAbcrf object.

obs

a data frame containing the summary statistics of the observed data sets.

training

the data frame containing the reference table used to train the regAbcrf object.

add

a boolean that indicates if the posterior distributions should be ploted on the same graph or not, when more than one observed summary statistics is given.

main

main title to be used for the posterior density plot.

log

a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic. The default value "" implies no logarithmic transfomation.

xlim

range of the abscissa.

ylim

range of the ordinate.

xlab

label of the abscissa.

ylab

label of the ordinate.

paral

a boolean that indicates if random forests predictions should be parallelized.

ncores

the number of CPU cores to use for the regression random forest predictions. If paral=TRUE, it is used the number of CPU cores minus 1. If ncores is not specified and detectCores does not detect the number of CPU cores with success then 1 core is used.

...

additional arguments to be passed on to density, as for example the smoothing bandwidth bw to be used.

References

Raynal L., Marin J.-M. Pudlo P., Ribatet M., Robert C. P. and Estoup, A. (2019) ABC random forests for Bayesian parameter inference Bioinformatics doi: 10.1093/bioinformatics/bty867

See Also

regAbcrf, predict.regAbcrf, err.regAbcrf, covRegAbcrf, ranger, plot.regAbcrf

Examples

data(snp)
modindex <- snp$modindex
sumsta <- snp$sumsta[modindex == "3",]
r <- snp$param$r[modindex == "3"]
r <- r[1:500]
sumsta <- sumsta[1:500,]
data2 <- data.frame(r, sumsta)
model.rf.r <- regAbcrf(r~., data2, ntree=100)
data(snp.obs)
densityPlot(model.rf.r, snp.obs, data2, ylab="density", main = "Posterior density of r")

abcrf documentation built on Aug. 9, 2022, 5:07 p.m.

Related to densityPlot in abcrf...