predict.ad: Predict method for ad Objects

Description Usage Arguments Details Value Examples

Description

Predict method for ad Objects

Usage

1
2
3
## S3 method for class 'ad'
predict(object, newdata, type = "class",
  na.action = na.pass, ...)

Arguments

object

An object of class ad, created by the function ad.

newdata

A data frame or matrix containing new data.

type

One of 'class' (for class prediction) or 'prob' (for probabilities).

na.action

A function specifying the action to be taken if NAs are found; default is to predict NA (na.pass).

...

Currently not used.

Details

Specifying 'class' for type returns the class of each observation as anomalous or non-anomalous. Specifying 'prob' returns the probability of each observation.

Value

A vector of predicted values.

Examples

1
2
3
4
5
6
7
x1 <- c(1,.2,3,1,1,.7,-2,-1)
x2 <- c(0,.5,0,.4,0,1,-.3,-.1)
x <- do.call(cbind,list(x1,x2))
y <- c(0,0,0,0,0,0,1,1)
dframe <- data.frame(x,y)
df_fit <- ad(y ~ x1 + x2, dframe)
predict(df_fit, newdata = dframe)

dbolotov/amelie documentation built on May 25, 2019, 4:23 p.m.