as.function.motbf: Coerce an '"motbf"' Object to a Function

Description Usage Arguments Details Value Examples

View source: R/motbf.R

Description

Takes an "motbf" object and contructs an R function to evaluate it at points.

Usage

1
2
## S3 method for class 'motbf'
as.function(x, ...)

Arguments

x

An object of class "motbf".

...

Further arguments to be passed to or from the method. Not necessary for this method.

Details

This is an S3 method for the generic function as.function.

Value

It returns a function to evaluate an object of class "motbf".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Data
X <- rchisq(5000, df = 3)

## Learning
P <- univMoTBF(X, POTENTIAL_TYPE = "MOP"); P

## Evaluation
as.function(P)(min(X))
as.function(P)(max(X))
as.function(P)(10)
density <- as.function(P)(X)

## Plot
hist(X, prob = TRUE, main = "")
points(X, density, col=4, pch=16)

MoTBFs documentation built on May 30, 2017, 12:17 a.m.