May I interpret confidence levels as confidence intervals in r

confidence intervalr

If I got values of lower .CL (confidence level) and upper .CL for a category of A factor, each o.206, 0.245 and

for b category of A factor, each 0.215 and 0.256 in R, can/may I so interpret?

: confidence Interval of a is [0.206, 0.245] and of b is [0.215, 0.256]?

  • Edited
A emmean SE df lower.CL upper.CL
a 0.21 0.0009 52 0.206 0.245
b 0.205 0.0009 52 0.215 0.256

Best Answer

To be explicit: Suppose you have the (fictitious) data sampled using R below:

set.seed(2021)
x = rnorm(20, 50, 7)
summary(x);  length(x);  sd(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  36.54   49.86   52.48   52.76   60.42   62.11 
[1] 20        # sample size
[1] 7.621391  # sample standard deviation

A boxplot and a stripchart (dotplot) of the data are shown below:

par(mfrow = c(2,1))
 boxplot(x, col="skyblue2", horizontal=T)
 stripchart(x, pch=20)
  abline(v=mean(x), col="red")
par(mfrow = c(1,1))

enter image description here

t.test(x, mu = 55)

        One Sample t-test

data:  x
t = -1.3151, df = 19, p-value = 0.2041
alternative hypothesis: true mean is not equal to 55
95 percent confidence interval:
 49.19194 56.32578
sample estimates:
mean of x 
 52.75886 

Then (because this is simulated data) we know population mean is $\mu = 50,$ sample mean is $52.76,$ which is not significantly different from hypothetical mean $\mu_0 = 55.$ A 95% CI for $\mu$ is $(49.19, 56.33).$ which is centered at $\bar X = 52.76$ and contains $\mu_0 = 55.$

In a real application you would never know that $\mu =50,$ exactly. The best point estimate is $\hat \mu = \bar X = 52.76$ and we can be 95% confident that $\mu$ is in interval $(49.19, 56.33).$

A narrower 90% confidence interval is $(49.81, 55.71).$

t.test(x, conf.lev=.90)$conf.int
[1] 49.81208 55.70564
attr(,"conf.level")
[1] 0.9

And a wider 99% CI is $(47.88, 57,63).$

t.test(x, conf.lev=.99)$conf.int
[1] 47.88327 57.63445
attr(,"conf.level")
[1] 0.99

To consolidate these relationships, you should look at the formula in your text or class notes for a one-sample t.test and use the summary information printed above for $n, \bar X, S_x$ to make all three confidence intervals, 90%, 95%, and 00%. Then check your hand computations with the results above from R.