Should the R confidence interval match up precisely with my calculated confidence interval?

44 Views Asked by At

For the data set (in thousands), 153, 146, 132, 164, 172, 159, 149, 166, 161, a 90% confidence interval for the population mean price was to be calculated.

My confidence interval was (149097.01, 162458.55).

When I calculated it on R, I used t.test(x, conf.level = .90).

The interval given by R was (148225.7, 163329.9).

Is this discrepancy acceptable? I don't think I made any mistakes with my math. Thanks.

1

There are 1 best solutions below

4
On

Let me show explicitly what does t.test compute

> a <- c(153, 146, 132, 164, 172, 159, 149, 166, 161) * 1000
> n <- length(a)
> s <- sd(a)
> m <- mean(a)
> error <- qt(0.95, df = n-1) * s/sqrt(n)
> m + error
[1] 163329.9
> m - error
[1] 148225.7

So most likely you have either made a mistake or used a different formula.