CIplot | R Documentation |
Illustration of the meaning of confidence levels. Generate sets of confidence intervals for independent randomly generated sets of normally distributed numbers. Low confidence levels give narrow intervals that are less likely to bracket the true value. Higher confidence levels increase the probability of bracketing the true value, and are also much wider and therefore less precise. The shiny app can animate how the increase in confidence level and width leads to a consequent decrease in precision.
CIplot(n.intervals = 100,
n.per.row = 40,
pop.mean = 0,
pop.sd = 1,
conf.level = 0.95,
...)
confintervaldata(n.intervals = 100,
n.per.row = 40,
pop.mean = 0,
pop.sd = 1,
conf.level = 0.95,
seed,
...)
confinterval.matrix(x,
conf.level = attr(x, "conf.level"),
...)
confintervalplot(x.ci,
n.intervals = nrow(x.ci),
pop.mean = attr(x.ci, "pop.mean"),
pop.sd = attr(x.ci, "pop.sd"),
n.per.row = attr(x.ci, "n.per.row"),
xlim, ylim, ...)
shiny.CIplot(height = "auto")
n.intervals |
Number of sets of observations to generate. Each set leads to one confidence interval on the plot. |
n.per.row |
Number of observations in each set. |
pop.mean , pop.sd |
Population mean and standard deviation for generated set of
|
conf.level |
Confidence level of each of the |
seed |
Standard argument to |
x |
Output matrix from |
x.ci |
Output |
xlim , ylim |
Standard |
height |
Height of graph on web page in pixels. |
... |
Additional arguments. For |
The shiny app has sliders for the n.intervals
, n.per.row
,
pop.mean
, pop.sd
, and conf.level
.
Changes in the conf.level
slider, either manually by animation,
use the same set of generated data to show how increasing the confidence
level increases the width of the confidence interval and consequently
decreases the precision of the interval estimator.
CIplot
and confintervalplot
return a "trellis"
plot containing a plot of Confidence Intervals.
confintervaldata
returns a matrix of n.intervals
rows by
n.per.row
columns of independent normally distributed random
numbers.
The matrix has a set of attributes recording the arguments to the
function.
confinterval.matrix
returns a data.frame
of n.intervals
with three columns containing the lower bound, center, and upper bound
of the confidence interval for each row of its input matrix.
The data.frame
has a set of attributes recording the arguments to the
function.
shiny.CIplot
returns a shiny app object which, when printed,
runs a shiny app displaying the Confidence Interval plot and several
slider controls.
Richard M. Heiberger <rmh@temple.edu>
## A. from the console
## example 1
CIplot()
## example 2
## Not run:
CIplot(n.intervals=100,
n.per.row=40,
pop.mean=0,
pop.sd=1,
conf.level=.95)
## End(Not run)
## example 3
## Not run:
tmp.data <- confintervaldata()
tmp.ci <- confinterval.matrix(tmp.data)
confintervalplot(tmp.ci)
## End(Not run)
## example 4
## Not run:
tmp.data <- confintervaldata(n.intervals=100,
n.per.row=40,
pop.mean=0,
pop.sd=1,
conf.level=.95)
tmp.ci <- confinterval.matrix(tmp.data)
confintervalplot(tmp.ci)
## End(Not run)
## B. shiny, initiated from the console
## example 5
## Not run:
if (interactive())
shiny.CIplot()
## End(Not run)
## example 6
## Not run:
if (interactive())
shiny.CIplot(height=800) ## px
## take control of the height of the graph in the web page
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.