| CImu_data {exams.forge} | R Documentation |
Confidence Intervals
Description
The CImu_data function is designed for the generation of confidence intervals pertaining to a population mean mu.
The function accommodates scenarios in which a dataset x is either provided or generated through a random sampling process
from a normal distribution, with user-specified parameters such as a mean mu and a standard deviation sigma.
Subsequently, the function computes essential statistical measures, including the sample mean xbar and the standard deviation sd.
Confidence intervals for the population mean are then calculated at user-defined confidence levels (conf.level).
The output is a structured list containing pertinent statistics, encompassing the mean, sample standard deviation,
confidence intervals, and other relevant details.
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
)
Arguments
x |
numeric: vector of data values |
n |
numeric: length of the vector x (if |
xbar |
numeric: sample mean |
sd |
numeric: sample standard deviation |
conf.level |
numeric: vector of confidence levels of the interval (default: |
mu |
numeric: true value of the mean |
sigma |
numeric: vector of possible variance |
Value
a list with
-
awith1-(1-conf.level)/2 -
nnumber observations if given -
xbarmean of observations if not given -
mutheoretical mean if given -
sdstandard deviation of observations -
sigmatheoretical standard deviation if given -
dfdegrees of freedom if atdistribution is used -
qifsigma=NULL -
sseithersdorsigma -
emargin of error (half of the length of the confidence interval(s)) -
llength of the confidence interval(s) -
vendpoints of the confidence interval(s)
Examples
# with data
x <- rnorm(100)
CImu_data(x, conf.level=0.95)
# simulate data internally
CImu_data(n=100, conf.level=0.95, mu=0, sigma=1)