predict.abcrf: Predict and evaluate the posterior probability of the MAP for...

View source: R/predict.abcrf.R

predict.abcrfR Documentation

Predict and evaluate the posterior probability of the MAP for new data using an ABC-RF object

Description

Based on an ABC-RF object this function predicts the best model for new data and evaluate the posterior probability of the MAP.

Usage

## S3 method for class 'abcrf'
predict(object, obs, training, ntree = 1000, 
sampsize = min(1e5,  object$model.rf$num.samples ), paral = FALSE,
ncores = if(paral) max(detectCores()-1,1) else 1, paral.predict = FALSE, 
ncores.predict = if(paral.predict) max(detectCores()-1,1) else 1, ...)

Arguments

object

an abcrf 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 abcrf object.

ntree

number of trees to grow in the regression forest, by default 1,000 trees.

sampsize

size of the sample from the reference table used to grow a tree of the forest, by default the minimum between the number of elements of the reference table and 100,000.

paral

a boolean that indicates if the calculations of the regression random forest (forest that returns the posterior probability of the selected model) should be parallelized.

ncores

the number of CPU cores to use for the regression random forest construction. 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.

paral.predict

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

ncores.predict

the number of CPU cores to use for random forest predictions (classification and regression). If paral.predict=TRUE, it is used the number of CPU cores minus 1. If ncores.predict 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 ranger used to construct the regression random forest that estimates the posterior probability of the selected model.

Value

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

allocation

indices of the selected models for each observed data set,

vote

votes for each observed dataset,

post.prob

ABC-RF approximations of the posterior probability of the selected model for each observed dataset.

References

Pudlo P., Marin J.-M., Estoup A., Cornuet J.-M., Gautier M. and Robert, C. P. (2016) Reliable ABC model choice via random forests Bioinformatics doi: 10.1093/bioinformatics/btv684

See Also

abcrf, plot.abcrf, err.abcrf

Examples

data(snp)
modindex <- snp$modindex[1:500]
sumsta <- snp$sumsta[1:500,]
data1 <- data.frame(modindex, sumsta)
model.rf <- abcrf(modindex~., data1, ntree=100)
data(snp.obs)
predict(model.rf, snp.obs, data1, ntree=100)

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

Related to predict.abcrf in abcrf...