In: Statistics and Probability
x=c(4,4,12,8,3,17,15)
mean(x)
[1] 9
t.test(x,mu=6) #[t(7)=1.92, p=.097]
One Sample t-test
data: x
t = 1.3887, df = 6, p-value = 0.2143
alternative hypothesis: true mean is not equal to 6
95 percent confidence interval:
3.714066 14.285934
sample estimates:
mean of x
9
> t.test(x,mu=6,alt='g') #note the p-value is half
One Sample t-test
data: x
t = 1.3887, df = 6, p-value = 0.1071
alternative hypothesis: true mean is greater than 6
95 percent confidence interval:
4.802251 Inf
sample estimates:
mean of x
9
What does u represent in one of the sample t-tests?
What does ‘g’ stand for in the second t-test?
What should u be set to given 2 (instead of 4)choices per item?
For the first one sample t test for two tailed;
Null hypothesis: There is no difference in means,
Alternate hypothesis: There is a significant difference in means,
From the result summary of t test,
The P-value = 0.2143 is greater than 0.05 at 5% significance level hence the null hypothesis can not be rejected at 5% significance level. Now we can state that there is no statistically significant difference in means at 5% significance level.
For the second one sample t test for one tailed;
Null hypothesis: There is no difference in means,
Alternate hypothesis: There is a significant difference in means,
From the result summary of t test,
The P-value = 0.1071 is greater than 0.05 at 5% significance level hence the null hypothesis can not be rejected at 5% significance level. Now we can state that there is not statistically significant greater mean at 5% significance level.
Each step for R code is explain below,
Data Array => x=c(4,4,12,8,3,17,15)
Mean of Data Array => mean(x)
Output for mean => [1] 9
One sample t test for two tailed (where 'x' is the data array and 'mu' is the hypothesized mean comparing with the mean of array 'x' =>
t.test(x,mu=6) #[t(7)=1.92, p=.097]
Output of One Sample t test =>
One Sample t-test
data: x
t = 1.3887, df = 6, p-value = 0.2143
alternative hypothesis: true mean is not equal to 6
95 percent confidence interval: 3.714066 14.285934
sample estimates:
mean of x
9
One sample t test for one tailed (where 'x' is the data array and 'mu' is the hypothesized mean comparing with the mean of array 'x' and alt='g' means the alternative hypothesis is greater than hypothesized mean 'mu' =>
t.test(x,mu=6,alt='g')
Output => One Sample t-test
data: x
t = 1.3887, df = 6, p-value = 0.1071
alternative hypothesis: true mean is greater than 6
95 percent confidence interval: 4.802251 Inf
sample estimates:
mean of x
9