# Vectors:
obs <- seq(10000, 100000, 10000)
status_1 <- c(0, 1, 1, 0, 0, 0, 1, 0, 1, 0)
cycles <- alloy$cycles
status_2 <- alloy$status
# Probability estimation:
prob_tbl <- estimate_cdf(
x = obs,
status = status_1,
method = "johnson"
)
prob_tbl_2 <- estimate_cdf(
x = cycles,
status = status_2,
method = "johnson"
)
# Model estimation with rank_regression():
rr <- rank_regression(
x = prob_tbl$x,
y = prob_tbl$prob,
status = prob_tbl$status,
distribution = "weibull",
conf_level = 0.9
)
rr_2 <- rank_regression(
x = prob_tbl_2$x,
y = prob_tbl_2$prob,
status = prob_tbl_2$status,
distribution = "lognormal3"
)
# Example 1 - Two-sided 95% confidence interval for probabilities ('y'):
conf_betabin_1 <- confint_betabinom(
x = prob_tbl$x,
status = prob_tbl$status,
dist_params = rr$coefficients,
distribution = "weibull",
bounds = "two_sided",
conf_level = 0.95,
direction = "y"
)
# Example 2 - One-sided lower/upper 90% confidence interval for quantiles ('x'):
conf_betabin_2_1 <- confint_betabinom(
x = prob_tbl$x,
status = prob_tbl$status,
dist_params = rr$coefficients,
distribution = "weibull",
bounds = "lower",
conf_level = 0.9,
direction = "x"
)
conf_betabin_2_2 <- confint_betabinom(
x = prob_tbl$x,
status = prob_tbl$status,
dist_params = rr$coefficients,
distribution = "weibull",
bounds = "upper",
conf_level = 0.9,
direction = "x"
)
# Example 3 - Two-sided 90% confidence intervals for both directions using
# a three-parametric model:
conf_betabin_3_1 <- confint_betabinom(
x = prob_tbl_2$x,
status = prob_tbl_2$status,
dist_params = rr_2$coefficients,
distribution = "lognormal3",
bounds = "two_sided",
conf_level = 0.9,
direction = "y"
)
conf_betabin_3_2 <- confint_betabinom(
x = prob_tbl_2$x,
status = prob_tbl_2$status,
dist_params = rr_2$coefficients,
distribution = "lognormal3",
bounds = "two_sided",
conf_level = 0.9,
direction = "x"
)
Run the code above in your browser using DataLab