ci_p_coverage_plot2: Plot for confidence interval p - coverage vs n for fixed p

View source: R/ci_p_coverage.R

ci_p_coverage_plot2R Documentation

Plot for confidence interval p - coverage vs n for fixed p

Description

This function plots the coverage for any confidence interval for p.

Usage

ci_p_coverage_plot2(
  p = 0.5,
  seq_n = seq(from = 10, to = 500, by = 10),
  conf.level = 0.95,
  intervalType = "wald",
  plot = TRUE,
  col = "deepskyblue2",
  linecolor = "tomato",
  ...
)

Arguments

p

true proportion p.

seq_n

sequence with the values of sample size n. By default is the sequence 10, 20, 30, ..., 480, 490, 500.

conf.level

nominal confidence level for the returned confidence interval. By default is 0.95.

intervalType

type of confidence interval, possible choices are listed in ci_p.

plot

logical value to obtain the plot, TRUE by default.

col

color for the coverage curve.

linecolor

color for the line representing the conf.level.

...

further arguments and graphical parameters passed to plot function.

Details

This function was inspired by the binomTestCoveragePlot() function from conf package and Park & Leemis (2019).

Value

A dataframe with Method, n, p and true coverage and the plot.

Author(s)

Laura Juliana Insignares Montes, linsignares@unal.edu.co

References

Park, H., & Leemis, L. M. (2019). Ensemble confidence intervals for binomial proportions. Statistics in Medicine, 38(18), 3460-3475.

See Also

ci_p.

Examples

ci_p_coverage_plot2(p=0.50,
                    conf.level=0.95,
                    intervalType="wald")

ci_p_coverage_plot2(p=0.75,
                    conf.level=0.95,
                    intervalType="wald")

ci_p_coverage_plot2(p=0.50,
                    conf.level=0.95,
                    intervalType="wilson")

ci_p_coverage_plot2(p=0.75,
                    conf.level=0.95,
                    intervalType="wilson",
                    col="orange", linecolor="purple")


fhernanb/stests documentation built on March 29, 2025, 10:36 a.m.