CImu_data: Confidence Intervals for a Population Mean
Description
Computes confidence intervals for a population mean (mu) using either
supplied data or data generated from a normal distribution with specified
parameters. The function calculates key statistics such as the sample mean,
standard deviation, and confidence intervals at user-defined confidence levels.
Results are returned as a structured list containing observed and/or theoretical
values, interval endpoints, and related measures.
Usage
CImu_data(
x = NULL,
n = length(x),
xbar = NULL,
sd = NULL,
conf.level = c(0.9, 0.95, 0.99),
mu = NULL,
sigma = NULL
)
dcimu(
x = NULL,
n = length(x),
xbar = NULL,
sd = NULL,
conf.level = c(0.9, 0.95, 0.99),
mu = NULL,
sigma = NULL
)
Value
A list containing:
a
upper-tail probability 1 - (1 - conf.level) / 2
n
sample size
xbar
sample mean
mu
theoretical mean (if provided)
sd
sample standard deviation
sigma
theoretical standard deviation (if provided)
df
degrees of freedom (if using a t distribution)
q
critical value(s) from the normal or t distribution
ss
standard deviation used in calculations (sd or sigma)
e
margin of error (half-width of the interval)
l
interval length
v
confidence interval endpoints
Arguments
x
numeric vector of observed data. If NULL, data are simulated.
n
integer: sample size (if n < 1, defaults to 5).
xbar
numeric: sample mean (computed from x if NULL).
sd
numeric: sample standard deviation (computed from x if NULL).
conf.level
numeric vector of confidence levels (default: c(0.9, 0.95, 0.99)).
mu
numeric: true population mean (used for simulation if x is NULL).
sigma
numeric: population standard deviation(s) (used for simulation if x is NULL).