2

In R, using the 'geyser' dataset from the MASS library, we are building a nonparametric tolerance interval cont. 90% of geyser eruptions w/ 99% CI

Please, find below the equation I am using:

no_param_pi <- function(x, conf.level = 0.90) {
  n <- length(x)
  x <- sort(x)
  j <- max(floor((n + 1) * (1 - conf.level) / 2), 1)
  conf.level <- (n + 1 - 2 * j)/(n + 1)
  interval <- c(x[j], x[n + 1 - j])
  attr(interval, "conf.level") <- conf.level
  interval
}

Here is the code I am playing with, and in which I am missing something... :

library(MASS)
library(tolerance)
head(geyser)

eruptions = subset(geyser, select = waiting:duration, increasing)

nptol.int(eruptions, alpha = 1 - 0.99, P = 0.9)

Looking for both

1 Answers1

0

Can you try these few lines of code:

eruptions <- geyser
nptol.int(eruptions$duration, alpha = 1 - 0.99, P = 0.9, side = 1)
nptol.int(eruptions$duration, alpha = 1 - 0.99, P = 0.9, side = 2)
nptol.int(eruptions$waiting, alpha = 1 - 0.99, P = 0.9, side = 1)
nptol.int(eruptions$waiting, alpha = 1 - 0.99, P = 0.9, side = 2)

Is this what are you looking for? You have many variations, so I suggest you look documentation under Help. ?nptol.int

Bloxx
  • 1,495
  • 1
  • 9
  • 21