plot.motbf {MoTBFs}R Documentation

Plots for 'motbf' objects

Description

Draws an 'motbf' function.

Usage

## S3 method for class 'motbf'
plot(x, xlim = 0:1, ylim = NULL, type = "l", ...)

Arguments

x

An object of class 'motbf'.

xlim

The range to be encompassed by the x axis; by default 0:1.

ylim

The range of the y axix.

type

As for plot.

...

Further arguments to be passed as for plot.

Value

A plot of the specificated function.

Examples


## 1. EXAMPLE 
## Data
X <- rexp(2000)

## Learning
f1 <- univMoTBF(X, POTENTIAL_TYPE = "MOP"); f1
f2 <- univMoTBF(X, POTENTIAL_TYPE = "MTE", maxParam = 10); f2
f3 <- univMoTBF(X, POTENTIAL_TYPE = "MOP", nparam=10); f3
## Plots
plot(NULL, xlim = range(X), ylim = c(0,0.8), xlab="X", ylab="density")
plot(f1, xlim = range(X), col = 1, add = TRUE)
plot(f2, xlim = range(X), col = 2, add = TRUE)
plot(f3, xlim = range(X), col = 3, add = TRUE)
hist(X, prob = TRUE, add= TRUE)

## 2. EXAMPLE 
## Data
X <- c(rnorm(2000, mean = -3),rnorm(2000, mean = 3))

## Learning
f1 <- univMoTBF(X, POTENTIAL_TYPE = "MOP"); f1
f2 <- univMoTBF(X, POTENTIAL_TYPE = "MTE"); f2
## Plots
plot(NULL, xlim = range(X), ylim = c(0,0.20), xlab="X", ylab="density")
plot(f1, xlim = range(X), col = 2, add = TRUE)
plot(f2, xlim = range(X), col = 4, add = TRUE)
hist(X, prob = TRUE, add= TRUE)


[Package MoTBFs version 1.4.1 Index]