densityPlot: Plot the posterior density given a new summary statistic

Description Usage Arguments References See Also Examples

View source: R/densityPlot.R

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

1
2
3
4
5
## 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 https://doi.org/10.1093/bioinformatics/bty867

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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")

Example output

Press <ENTER> to Continue
Warning messages:
1: In density.default(resp, weights = weights.std[, i], ...) :
 extra argument 'ylab' will be disregarded 
2: In density.default(resp, weights = weights.std[, i], ...) :
 extra argument 'ylab' will be disregarded 

abcrf documentation built on Nov. 5, 2019, 5:06 p.m.