predict.epx: Predict with an "'epx'" object

Description Usage Arguments Value Examples

View source: R/predictEPX.R

Description

Predicted values based on an "epx" object; may specify different base classifier arguments than those used for phalanx-formation.

Usage

1
2
## S3 method for class 'epx'
predict(object, newdata, classifier.args = list(), ...)

Arguments

object

Object of class "epx".

newdata

An optional data frame specifiying variables with which to predict; if omitted and classifier.args are not specified, the fitted (ensembled) values are used.

classifier.args

Additional arguments for the base classifier; same base classifier as that used for phalanx-formation (specified in epx).

...

Further arguments passed to or from other methods.

Value

Numeric vector of predicted values (double).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example with data(harvest)

## Phalanx-formation using a base classifier with 50 trees (default = 500)

set.seed(761)
model <- epx(x = harvest[, -4], y = harvest[, 4],
             classifier.args = list(ntree = 50))

## Predict training values without additional classifier.args and newdata
## returns the object's ENSEMBLED.FITS
all.equal(predict(model), model$ENSEMBLED.FITS)

## Predict training values using 100 trees (default = 500)
set.seed(761)
preds100 <- predict(model, classifier.args = list(ntree = 100))

## Predict test values by passing dataframe of test predictors to newdata as
## with the predict(model, newdata = . ) function etc.

EPX documentation built on July 7, 2021, 1:06 a.m.