Based on a reg-ABC-RF object this function predicts the posterior expectation, median, variance, quantiles for the corresponding parameter given new dataset. Somes posterior errors can be computed at an higher computational price.
# S3 method for 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,
post.err.med = FALSE, ...)
An object of class regAbcrfpredict
, which is a list with the following components:
predicted posterior expectation for each oberved data set,
predicted posterior median for each oberved data set,
predicted posterior variance for each observed data set, computed by reusing weights, this quantity is also the posterior mean squared error,
predicted posterior variance for each observed data set, computed by approximation of the cumulative distribution function,
predicted posterior quantiles for each observed data set,
a matrix composed of the weights used to predict quantities of interest. Returned if rf.weights
is TRUE,
posterior normalized mean absolute error obtained using the out-of-bag posterior expectation (mean) and previously computed random forest weights, for each observed data set,
posterior mean squared error obtained using the out-of-bag posterior median and previously computed random forest weights, for each observed data set,
posterior normalized mean absolute error obtained using the out-of-bag posterior expectation (mean) and previously computed random forest weights, for each observed data set,
prior mean squared error computed with training out-of-bag prediction based on mean of response variable,
prior normalized mean absolute error computed with training out-of-bag predictions based on mean of response variable,
prior mean squared error computed with training out-of-bag predictions based on median of response variable,
prior normalized mean absolute error with training out-of-bag predictions based on median of response variable,
prior credible inteval coverage computed for training instances, if only two quantiles are of interest, NULL otherwise.
a regAbcrf
object.
a data frame containing the summary statistics of the observed data sets.
the data frame containing the reference table used to train the regAbcrf
object.
numeric vector of probabilities with values in [0,1]. The default value is equal to c(0.025, 0.975)
.
a boolean that indicates if random forests predictions should be parallelized.
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.
a boolean that indicates if the random forest weights used to predict quantities of interest should we returned. The default value is FALSE.
a boolean that indicates if posterior errors based on posterior medians should be computed. The default value is FALSE. If computed, this function might take a much more time.
optional arguments to be passed on to the function predict.ranger
.
Raynal L., Marin J.-M. Pudlo P., Ribatet M., Robert C. P. and Estoup, A. (2019) ABC random forests for Bayesian parameter inference Bioinformatics tools:::Rd_expr_doi("10.1093/bioinformatics/bty867")
regAbcrf
,
predictOOB
,
plot.regAbcrf
,
err.regAbcrf
,
covRegAbcrf
,
ranger
,
densityPlot
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)
Run the code above in your browser using DataLab