Learn R Programming

daltoolbox (version 1.3.767)

smoothing_inter: Smoothing by equal interval

Description

Discretize a numeric vector into n equal‑width intervals (robust bounds via boxplot whiskers) and replace each value by the bin mean.

Usage

smoothing_inter(n)

Value

returns an object of class smoothing_inter

Arguments

n

number of bins

References

Han, J., Kamber, M., Pei, J. (2011). Data Mining: Concepts and Techniques. (Discretization)

Examples

Run this code
data(iris)
obj <- smoothing_inter(n = 2)
obj <- fit(obj, iris$Sepal.Length)
sl.bi <- transform(obj, iris$Sepal.Length)
table(sl.bi)
obj$interval

bins <- cut(iris$Sepal.Length, unique(obj$interval.adj), FALSE, include.lowest = TRUE)
entro <- evaluate(obj, bins, iris$Species)
entro$entropy

Run the code above in your browser using DataLab