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

Description Usage Arguments Value References See Also Examples

View source: R/predict.abcrf.R

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

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

See Also

abcrf, plot.abcrf, err.abcrf

Examples

1
2
3
4
5
6
7
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)

Example output

  selected model votes model1 votes model2 votes model3 post.proba
1              3         0.07         0.01         0.92     0.9095
2              2         0.03         0.64         0.33     0.7195

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