DistrCollection | R Documentation |
R6 Class for Managing a Collection of Distribution Objects
distr
List of Distr
objects.
new()
Initialize the fields of the DistrCollection
object.
DistrCollection$new()
add()
Add a Distr
object to the collection.
DistrCollection$add(distr)
distr
A Distr
object to add to the collection.
get()
Get a Distr
object from the collection by its index.
DistrCollection$get(i)
i
Integer index of the Distr
object to retrieve.
A Distr
object.
print()
Print the summary of all distributions in the collection.
DistrCollection$print()
summary()
Summarize the goodness of fit for all distributions in the collection.
DistrCollection$summary()
A data frame with distribution names, Anderson-Darling test statistics, and p-values.
plot()
Plot all distributions in the collection.
DistrCollection$plot( xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, line.col = "red", fill.col = "lightblue", border.col = "black", line.width = 1, box = TRUE )
xlab
Character string for the x-axis label.
ylab
Character string for the y-axis label.
xlim
Numeric vector specifying the x-axis limits.
ylim
Numeric vector specifying the y-axis limits.
line.col
Character string for the color of the plot line. Default is "red".
fill.col
Character string for the color of the histogram fill. Default is "lightblue".
border.col
Character string for the color of the histogram border. Default is "black".
line.width
Numeric value specifying the width of the plot line. Default is 1.
box
Logical value indicating whether to draw a box with the parameters in the plot. Default is TRUE.
clone()
The objects of this class are cloneable with this method.
DistrCollection$clone(deep = FALSE)
deep
Whether to make a deep clone.
Distr
, distribution
, FitDistr
set.seed(123)
data1 <- rnorm(100, mean = 5, sd = 2)
parameters1 <- list(mean = 5, sd = 2)
distr1 <- Distr$new(x = data1, name = "normal",
parameters = parameters1, sd = 2,
n = 100, loglik = -120)
data2 <- rpois(100, lambda = 3)
parameters2 <- list(lambda = 3)
distr2 <- Distr$new(x = data2, name = "poisson",
parameters = parameters2, sd = sqrt(3),
n = 100, loglik = -150)
collection <- DistrCollection$new()
collection$add(distr1)
collection$add(distr2)
collection$summary()
collection$plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.