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. Somes posterior errors can be computed at an higher computational price.

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,
post.err.med = 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.

post.err.med

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.

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, this quantity is also the posterior mean squared error,

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,

post.NMAE.mean

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,

post.MSE.med

posterior mean squared error obtained using the out-of-bag posterior median and previously computed random forest weights, for each observed data set,

post.NMAE.med

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.MSE

prior mean squared error computed with training out-of-bag prediction based on mean of response variable,

prior.NMAE

prior normalized mean absolute error computed with training out-of-bag predictions based on mean of response variable,

prior.MSE.med

prior mean squared error computed with training out-of-bag predictions based on median of response variable,

prior.NMAE.med

prior normalized mean absolute error with training out-of-bag predictions based on median of response variable,

prior.coverage

prior credible inteval coverage computed for training instances, if only two quantiles are of interest, NULL otherwise.

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, predictOOB, 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)

Example output

     expectation    median    variance variance.cdf quantile= 0.025
[1,]   0.5299395 0.5466234 0.006873559   0.01327826      0.29582384
[2,]   0.2765182 0.2857484 0.033269534   0.02423332      0.07730174
     quantile= 0.975
[1,]       0.7407615
[2,]       0.6755349

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