Description Usage Format Source Examples
Waiting time between eruptions and the duration of the eruption
for the Old Faithful geyser in Yellowstone National Park,
Wyoming, USA from datasets
.
1 |
A data frame with 272 observations on 2 variables:
numeric, eruption time in mins
numeric, waiting time to next eruption (in mins)
Azzalini, A. and Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. Applied Statistics, 39, 357–365.
datasets
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | data(faithful)
faithful.obs <- faithful$waiting
# function giving the j^th raw moment of the standard normal distribution,
# needed for calculation of the Hankel matrix via the "translation" method
# (assuming gaussian components with variance 1)
mom.std.norm <- function(j){
ifelse(j %% 2 == 0, prod(seq(1, j - 1, by = 2)), 0)
}
# generate list of parameter bounds
norm.bound.list <- list("mean" = c(-Inf, Inf), "sd" = c(0, Inf))
# define the MLE functions for the mean and sd:
MLE.norm.mean <- function(dat) mean(dat)
MLE.norm.sd <- function(dat){
sqrt((length(dat) - 1) / length(dat)) * sd(dat)
}
MLE.norm.list <- list("MLE.norm.mean" = MLE.norm.mean, "MLE.norm.sd" = MLE.norm.sd)
# construct a 'datMix' object that summarizes all the necessary information:
faithful.dM <- datMix(faithful.obs, dist = "norm", discrete = FALSE,
theta.bound.list = norm.bound.list,
MLE.function = MLE.norm.list, Hankel.method = "translation",
Hankel.function = mom.std.norm)
# estimate the number of components and plot the results:
res <- hellinger.cont(faithful.dM, bandwidth = 4,
sample.n = 5000, threshold = "AIC")
plot(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.