sprt | R Documentation |
Performs the SPRT for Bernoulli, Normal, or Poisson data.
sprt(
x,
alpha = 0.05,
beta = 0.05,
p0,
p1,
dist = c("bernoulli", "poisson", "normal"),
sigma = 1
)
x |
Vector of observed values. |
alpha |
Type I error rate. |
beta |
Type II error rate. |
p0 |
Null hypothesis parameter (probability or mean). |
p1 |
Alternative hypothesis parameter (probability or mean). |
dist |
Distribution: "bernoulli", "normal", or "poisson". |
sigma |
Standard deviation (for normal distribution only). |
A list with elements:
decision |
"Accept H0", "Reject H0", or "Continue sampling" |
n_decision |
Step at which decision was made (NA if continue) |
logL |
Cumulative log-likelihood ratios for each step |
A |
Upper threshold (log scale) |
B |
Lower threshold (log scale) |
x <- c(0,0,1,0,1,1,1,0,0,1,0,0)
res <- sprt(x, alpha = 0.05, beta = 0.1, p0 = 0.1, p1 = 0.3)
print(res)
x1 <- c(52, 55, 58, 63, 66, 70, 74)
result1 <-sprt(x1, alpha = 0.05, beta = 0.1, p0 = 50, p1 = 65, dist = "normal", sigma = 10)
result1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.