View source: R/UBStats_Main_Visible_ALL_202406.R
CI.mean | R Documentation |
CI.mean()
builds confidence intervals for the mean of a population.
CI.mean(
x,
sigma = NULL,
conf.level = 0.95,
digits = 2,
force.digits = FALSE,
use.scientific = FALSE,
data,
...
)
x |
An unquoted string identifying the numeric
variable whose mean is of interest. |
sigma |
An optional numeric value specifying the
population standard deviation. If |
conf.level |
Numeric value specifying the required confidence level; default to 0.95. |
digits |
Integer value specifying the number of
decimals used to round statistics; default to 2. If the chosen rounding formats some
non-zero values as zero, the number of decimals is increased
so that all values have at least one significant digit, unless the argument
|
force.digits |
Logical value indicating whether reported values
should be forcedly rounded to the number of decimals specified in
|
use.scientific |
Logical value indicating whether numbers
in tables should be displayed using
scientific notation ( |
data |
An optional data frame containing |
... |
Additional arguments to be passed to low level functions. |
A table reporting the confidence interval for the population mean. If the variance is unknown, the interval is built using percentiles from both the normal and the Student's t distribution.
Raffaella Piccarreta raffaella.piccarreta@unibocconi.it
TEST.mean()
to test hypotheses on a population
mean.
data(MktDATA, package = "UBStats")
# CI for the mean with KNOWN variance; default options
CI.mean(AOV, sigma = 30, data = MktDATA)
# CI for the mean with UNKNOWN variance;
# - change digits and confidence level 0.99
CI.mean(AOV, conf.level = 0.99, digits = 3, data = MktDATA)
# Arguments force.digits and use.scientific
# A variable taking very small values
SmallX<-MktDATA$AOV/5000
# - Default: manages possible excess of rounding
CI.mean(SmallX)
# - Forcing digits to the default values (2)
CI.mean(SmallX, force.digits = TRUE)
# - Allow scientific notation
CI.mean(SmallX, use.scientific = TRUE)
# Output the table with the requested interval
out.ci_mean<-CI.mean(AOV, data = MktDATA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.