predict.MetaForest: MetaForest prediction

Description Usage Arguments Value See Also Examples

View source: R/predict.MetaForest.R

Description

MetaForest prediction

Usage

1
2
3
## S3 method for class 'MetaForest'
predict(object, data = NULL, type = "response",
  ...)

Arguments

object

MetaForest object.

data

New test data of class data.frame.

type

Type of prediction. One of 'response', 'se', 'terminalNodes' with default 'response'. See below for details.

...

further arguments passed to or from other methods.

Value

Object of class MetaForest.prediction with elements

predictions Predicted classes/values (only for classification and regression)
num.trees Number of trees.
num.independent.variables Number of independent variables.
treetype Type of forest/tree. Classification, regression or survival.
num.samples Number of samples.

See Also

ranger

Examples

1
2
3
4
5
6
7
8
set.seed(56)
data <- SimulateSMD(k_train = 100, model = es * x[,1] * x[,2])
#Conduct fixed-effects MetaForest analysis
mf.fixed <- MetaForest(formula = yi ~ ., data = data$training,
                      whichweights = "fixed", method = "DL")
predicted <- predict(mf.fixed, data = data$testing)$predictions
r2_cv <- sum((predicted - mean(data$training$yi)) ^ 2)/
         sum((data$testing$yi - mean(data$training$yi)) ^ 2)

Example output

Loading required package: ggplot2
Loading required package: metafor
Loading required package: Matrix
Loading 'metafor' package (version 2.4-0). For an overview 
and introduction to the package please type: help(metafor).
Loading required package: ranger
Loading required package: data.table

metaforest documentation built on Jan. 8, 2020, 9:06 a.m.