We can do z-test, t-test and find confidence intervals for the mean
of a normal distribution and do the elementary statistical inference.
> x
[1] -1.7 -1.3 -5.0 0.2 6.0 1.5 2.3 2.7
> y
[1] 12 34 5 12 6 7 2345 2
> t.test(x,mu=23,var=2)
One-sample t-Test
data: x
t = -19.0285, df = 7, p-value = 0
alternative hypothesis: true mean is not equal to 23
95 percent confidence interval:
-2.197641 3.372641
sample estimates:
mean of x
0.5875
> t.test(x,mu=2,alternative="greater")
One-sample t-Test
data: x
t = -1.1992, df = 7, p-value = 0.8653
alternative hypothesis: true mean is greater than 2
95 percent confidence interval:
-1.644004 NA
sample estimates:
mean of x
0.5875
> t.test(x,mu=10)
One-sample t-Test
data: x
t = -7.9913, df = 7, p-value = 1e-04
alternative hypothesis: true mean is not equal to 10
95 percent confidence interval:
-2.197641 3.372641
sample estimates:
mean of x
0.5875
> t.test(x,y)
Standard Two-Sample t-Test
data: x and y
t = -1.0361, df = 14, p-value = 0.3177
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-928.041 323.466
sample estimates:
mean of x mean of y
0.5875 302.875
> t.test(x,y,var.equal=F)
Welch Modified Two-Sample t-Test
data: x and y
t = -1.0361, df = 7, p-value = 0.3346
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-992.1753 387.6003
sample estimates:
mean of x mean of y
0.5875 302.875
> t.test(x,y,var.equal=T)
Standard Two-Sample t-Test
data: x and y
t = -1.0361, df = 14, p-value = 0.3177
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-928.041 323.466
sample estimates:
mean of x mean of y
0.5875 302.875
> t.test(x,y,paired=T)
Paired t-Test
data: x and y
t = -1.037, df = 7, p-value = 0.3342
alternative hypothesis: true mean of differences is not equal to 0
95 percent confidence interval:
-991.6102 387.0352
sample estimates:
mean of x - y
-302.2875
