Usage
plotCiNormDesign(x.var = "n", y.var = "half.width", range.x.var = NULL, n.or.n1 = 25, n2 = n.or.n1, half.width = sigma.hat/2, sigma.hat = 1, conf.level = 0.95, sample.type = ifelse(missing(n2), "one.sample", "two.sample"), round.up = FALSE, n.max = 5000, tol = 1e-07, maxiter = 1000, plot.it = TRUE, add = FALSE, n.points = 100, plot.col = "black", plot.lwd = 3 * par("cex"), plot.lty = 1, digits = .Options$digits, main = NULL, xlab = NULL, ylab = NULL, type = "l", ...)
Arguments
x.var
character string indicating what variable to use for the x-axis.
Possible values are "n"
(sample size; the default),
"half.width"
(the half-width of the confidence interval),
"sigma.hat"
(the estimated standard deviation), and
"conf.level"
(the confidence level).
y.var
character string indicating what variable to use for the y-axis.
Possible values are "half.width"
(the half-width of the confidence interval; the default), and
"n"
(sample size).
range.x.var
numeric vector of length 2 indicating the range of the x-variable to use for the plot.
The default value depends on the value of x.var
.
When x.var="n"
the default value is c(2,50)
.
When x.var="half.width"
the default value is c(0.1/sigma.hat, 2/sigma.hat)
.
When x.var="sigma.hat"
, the default value is c(0.1, 2)
.
When x.var="conf.level"
, the default value is c(0.5, 0.99)
.
n.or.n1
numeric scalar indicating the sample size. The default value is n.or.n1=25
.
When sample.type="one.sample"
, this argument denotes the number of observations
in the single sample.
When sample.type="two.sample"
, this argument denotes the number of observations
from group 1.
Missing (NA
), undefined (NaN
), and infinite (Inf
, -Inf
) values are not allowed.
This argument is ignored if either x.var="n"
or y.var="n"
.
n2
numeric scalar indicating the sample size for group 2.
The default value is the value of n.or.n1
.
Missing (NA
), undefined (NaN
), and infinite (Inf
, -Inf
) values are not allowed.
This argument is ignored when
sample.type="one.sample"
.
half.width
positive numeric scalar indicating the half-width of the confidence interval.
The default value is sigma.hat/2
.
Missing (NA
), undefined (NaN
), and infinite (Inf
, -Inf
) values are not allowed.
This argument is ignored if either
x.var="half.width"
or y.var="half.width"
.
sigma.hat
positive numeric scalar specifying the estimated standard deviation.
The default value is sigma.hat=1
.
This argument is ignored if x.var="sigma.hat"
.
conf.level
a scalar between 0 and 1 indicating the confidence level associated with the confidence interval.
The default value is conf.level=0.95
. This argument is ignored if x.var="conf.level"
.
sample.type
character string indicating whether this is a one-sample or two-sample confidence interval.
When sample.type="one.sample"
, the computations for the plot are based on a confidence
interval for a single mean.
When sample.type="two.sample"
, the computations for the
plot are based on a confidence interval for the difference between two means.
The default value is sample.type="one.sample"
unless the argument n2
is supplied.
round.up
logical scalar indicating whether to round up the computed sample sizes to the next smallest integer.
The default value is round.up=FALSE
. This argument is ignored unless y.var="n"
.
n.max
for the case when y.var="n"
, positive integer greater than 1
specifying the maximum sample size for the single
group when sample.type="one.sample"
or for group 1 when
sample.type="two.sample"
. The default value is n.max=5000
.
tol
for the case when y.var="n"
, numeric scalar indicating the tolerance to
use in the uniroot
search algorithm. The default value is
tol=1e-7
.
maxiter
for the case when y.var="n"
, positive integer indicating the maximum
number of iterations to use in the uniroot
search algorithm.
The default value is maxiter=1000
.
plot.it
a logical scalar indicating whether to create a plot or add to the existing plot
(see explanation of the argument add
below) on the current graphics device.
If plot.it=FALSE
, no plot is produced, but a list of (x,y) values is returned
(see the section VALUE). The default value is plot.it=TRUE
.
add
a logical scalar indicating whether to add the design plot to the existing plot (add=TRUE
),
or to create a plot from scratch (add=FALSE
). The default value is add=FALSE
.
This argument is ignored if plot.it=FALSE
.
n.points
a numeric scalar specifying how many (x,y) pairs to use to produce the plot.
There are n.points
x-values evenly spaced between range.x.var[1]
and
range.x.var[2]
. The default value is n.points=100
.
plot.col
a numeric scalar or character string determining the color of the plotted line or points. The default value
is plot.col=1
. See the entry for col
in the help file for par
for more information.
plot.lwd
a numeric scalar determining the width of the plotted line. The default value is
3*par("cex")
. See the entry for lwd
in the help file for par
for more information.
plot.lty
a numeric scalar determining the line type of the plotted line. The default value is
plot.lty=1
. See the entry for lty
in the help file for par
for more information.
digits
a scalar indicating how many significant digits to print out on the plot. The default
value is the current setting of options("digits")
.
main, xlab, ylab, type, ...
additional graphical parameters (see par
).