predict.regAbcrf: Predict posterior expectation, median, variance and quantiles...

Description Usage Arguments Value References See Also Examples

View source: R/predict.regAbcrf.R

Description

Based on a reg-ABC-RF object this function predicts the posterior expectation, median, variance, quantiles for the corresponding parameter given new dataset.

Usage

1
2
3
4
## S3 method for class 'regAbcrf'
predict(object, obs, training, quantiles=c(0.025,0.975),
paral = FALSE, ncores = if(paral) max(detectCores()-1,1) else 1,
rf.weights = FALSE,...)

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.

quantiles

numeric vector of probabilities with values in [0,1]. The default value is equal to c(0.025, 0.975).

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.

rf.weights

a boolean that indicates if the random forest weights used to predict quantities of interest should we returned. The default value is FALSE.

...

optional arguments to be passed on to the function predict.ranger.

Value

An object of class regAbcrfpredict, which is a list with the following components:

expectation

predicted posterior expectation for each oberved data set,

med

predicted posterior median for each oberved data set,

variance

predicted posterior variance for each observed data set, computed by reusing weights,

variance.cdf

predicted posterior variance for each observed data set, computed by approximation of the cumulative distribution function,

quantiles

predicted posterior quantiles for each observed data set,

weights

a matrix composed of the weights used to predict quantities of interest. Returned if rf.weights is TRUE.

References

Marin, J.-M., Raynal, L., Pudlo, P., Ribatet, M. and Robert, C.P. (2016) ABC random forests for Bayesian parameter inference https://arxiv.org/pdf/1605.05537.pdf

See Also

regAbcrf, plot.regAbcrf, err.regAbcrf, covRegAbcrf, ranger, densityPlot

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)
predict(model.rf.r, snp.obs, data2)

abcrf documentation built on Sept. 4, 2017, 5:02 p.m.