relfreq: Relative Frequency Plots

Description Usage Arguments Details See Also Examples

Description

This Function creates the relative frequency plots of a box defined by define_fixbox.

Usage

1
relfreq(fixbox, plot_together = TRUE, ...)

Arguments

fixbox

object of class "fixbox" to be used to create the relative frequency plots.

plot_together

logical. If TRUE all plots are drawn together in one figure by par(mfrow = ...).

...

further arguments of the functions plot and barplot.

Details

Relative frequency plots are a diagnostic tool for a result of PRIM (fixbox). These are histograms or barplots illustrating ratios of distributions r_{jk} for each variable x_j. This ratio is defined by the distribution of x_j in one box B_k divided by the distribution of this variable over the whole data set.

See Also

define_fixbox, PRIM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# generating random data:
set.seed(123)
n <- 500
x1 <- runif(n = n, min = -1)
x2 <- runif(n = n, min = -1)
x3 <- runif(n = n, min = -1)
cat <- as.factor(sample(c("a","b","c", "d"), size = n, replace = TRUE))
wsk <- (1-sqrt(x1^2+x2^2)/sqrt(2))
y <- as.logical(rbinom(n = n, prob = wsk, size = 1))
dat <- cbind.data.frame(y, x1, x2, x3, cat)
plot(dat$x1, dat$x2, col=dat$y+1, pch=16)
remove(x1, x2, x3, y, wsk, cat, n)

# apply the PRIM function to find the best box with a support of at least 0.1:
p <- PRIM(y~., data=dat, beta_min = 0.1, max_boxes = 1, print_position = FALSE)

# relative frequency plots:
relfreq(p$fixboxes[[1]])

ao90/PRIM documentation built on May 5, 2019, 8:01 p.m.