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
-
a
with1-(1-conf.level)/2
-
n
number observations if given -
xbar
mean of observations if not given -
mu
theoretical mean if given -
sd
standard deviation of observations -
sigma
theoretical standard deviation if given -
df
degrees of freedom if at
distribution is used -
q
ifsigma=NULL
-
ss
eithersd
orsigma
-
e
margin of error (half of the length of the confidence interval(s)) -
l
length of the confidence interval(s) -
v
endpoints 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)