(bedrooms ~ waterfront, data = house_prices) ## ## Welch Two Sample t-test ## ## data: bedrooms by waterfront ## t = 0.83568, df = 163.83, p-value = 0.4046 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -0.09643533 0.23795892 ## sample estimates: ## mean in group FALSE mean in group TRUE ## 3.371375                                      3.300613

MATLAB: An Introduction with Applications
6th Edition
ISBN:9781119256830
Author:Amos Gilat
Publisher:Amos Gilat
Chapter1: Starting With Matlab
Section: Chapter Questions
Problem 1P
icon
Related questions
Question

Interpret the 95% confidence interval given in the t.test() output from Lesson 10, in context. Does this interval agree with the conclusion you reached in the hypothesis test by using the p-value?

t.test(bedrooms ~ waterfront, data = house_prices) ## ##

Welch Two Sample t-test ## ## data: bedrooms by waterfront

## t = 0.83568, df = 163.83, p-value = 0.4046

## alternative hypothesis: true difference in means is not equal to 0

## 95 percent confidence interval: ## -0.09643533 0.23795892

## sample estimates:

## mean in group FALSE mean in group TRUE

## 3.371375                                      3.300613

ysis
Test Statistic
Let's revisit our sample statistics:
favstats (bedrooms waterfront,
## waterfront min Q1 median Q3 max
## 1
FALSE 0 3
## 2
TRUE 1 3
data
waterfront, data = house_prices)
Using R as a calculator:
We have the following:
• xf = 3.37, t = 3.30, soft = 0.07
• Sf = 0.93, st = 1.08
• nf = 21450, nt = 163
We'll use all these in calculating the test statistic:
## [1] 0.8251786
mean
34 33 3.371375 0.9288559 21450
3 4 6 3.300613 1.0780353 163
Therefore, the test statistic is T = 0.83.
T=
(3.37 3.30)/sqrt(0.93^2/21450 +1.08^2/163)
=
sd
(x-x) - 0
n missing
+
0
0
p-value
Because the alternative hypothesis, HA: Mf - Mt 0, does not specify a direction, the p-value must account for
statistically significant "evidence" being in either direction (in favor of waterfront homes or non-waterfront homes). Therefore,
we need to multiply the regular one-sided p-value by 2:
Transcribed Image Text:ysis Test Statistic Let's revisit our sample statistics: favstats (bedrooms waterfront, ## waterfront min Q1 median Q3 max ## 1 FALSE 0 3 ## 2 TRUE 1 3 data waterfront, data = house_prices) Using R as a calculator: We have the following: • xf = 3.37, t = 3.30, soft = 0.07 • Sf = 0.93, st = 1.08 • nf = 21450, nt = 163 We'll use all these in calculating the test statistic: ## [1] 0.8251786 mean 34 33 3.371375 0.9288559 21450 3 4 6 3.300613 1.0780353 163 Therefore, the test statistic is T = 0.83. T= (3.37 3.30)/sqrt(0.93^2/21450 +1.08^2/163) = sd (x-x) - 0 n missing + 0 0 p-value Because the alternative hypothesis, HA: Mf - Mt 0, does not specify a direction, the p-value must account for statistically significant "evidence" being in either direction (in favor of waterfront homes or non-waterfront homes). Therefore, we need to multiply the regular one-sided p-value by 2:
# Take 1 - pt() because T>0
2* (1 pt(0.83,
df = 162).)
-
## [1] 0.4077602
The p-value is 0.41. Because this is greater than 0.05, we fail to reject the null hypothesis.
Conclusion: We do not have enough evidence to conclude that the average number of bedrooms for waterfront homes is
different from the average number of bedrooms for non-waterfront homes.
t.test()
Because the two-sample t-test is such a frequently-used statistical procedure, R has a built-in function that does all of these
"by-hand" calculations for us! Though, it is still important to be able to read and interpret the output.
The t.test() syntax follows some of the usual mosaic syntax that we've seen throughout the course:
t.test(bedrooms ~ waterfront, data = house_prices)
##
## Welch Two Sample t-test
##
## data: bedrooms by waterfront
## t = 0.83568, df = 163.83, p-value = 0.4046
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.09643533 0.23795892
## sample estimates:
## mean in group FALSE mean in group TRUE
##
3.371375
3.300613
This gives the test statistic ( t ), the p-value, and a 95% confidence interval all in the same output! Note that the t and
p-value we found "by-hand" were slightly different due to round off error. We can use this output to reach the same
conclusion as above - not enough evidence to conclude there is a difference in mean bedrooms between waterfront and non-
waterfront homes.
Transcribed Image Text:# Take 1 - pt() because T>0 2* (1 pt(0.83, df = 162).) - ## [1] 0.4077602 The p-value is 0.41. Because this is greater than 0.05, we fail to reject the null hypothesis. Conclusion: We do not have enough evidence to conclude that the average number of bedrooms for waterfront homes is different from the average number of bedrooms for non-waterfront homes. t.test() Because the two-sample t-test is such a frequently-used statistical procedure, R has a built-in function that does all of these "by-hand" calculations for us! Though, it is still important to be able to read and interpret the output. The t.test() syntax follows some of the usual mosaic syntax that we've seen throughout the course: t.test(bedrooms ~ waterfront, data = house_prices) ## ## Welch Two Sample t-test ## ## data: bedrooms by waterfront ## t = 0.83568, df = 163.83, p-value = 0.4046 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -0.09643533 0.23795892 ## sample estimates: ## mean in group FALSE mean in group TRUE ## 3.371375 3.300613 This gives the test statistic ( t ), the p-value, and a 95% confidence interval all in the same output! Note that the t and p-value we found "by-hand" were slightly different due to round off error. We can use this output to reach the same conclusion as above - not enough evidence to conclude there is a difference in mean bedrooms between waterfront and non- waterfront homes.
Expert Solution
Step 1

Concept: Confidence interval is the range in which at certain level of significance,the population parameter is gonna lie.

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
MATLAB: An Introduction with Applications
MATLAB: An Introduction with Applications
Statistics
ISBN:
9781119256830
Author:
Amos Gilat
Publisher:
John Wiley & Sons Inc
Probability and Statistics for Engineering and th…
Probability and Statistics for Engineering and th…
Statistics
ISBN:
9781305251809
Author:
Jay L. Devore
Publisher:
Cengage Learning
Statistics for The Behavioral Sciences (MindTap C…
Statistics for The Behavioral Sciences (MindTap C…
Statistics
ISBN:
9781305504912
Author:
Frederick J Gravetter, Larry B. Wallnau
Publisher:
Cengage Learning
Elementary Statistics: Picturing the World (7th E…
Elementary Statistics: Picturing the World (7th E…
Statistics
ISBN:
9780134683416
Author:
Ron Larson, Betsy Farber
Publisher:
PEARSON
The Basic Practice of Statistics
The Basic Practice of Statistics
Statistics
ISBN:
9781319042578
Author:
David S. Moore, William I. Notz, Michael A. Fligner
Publisher:
W. H. Freeman
Introduction to the Practice of Statistics
Introduction to the Practice of Statistics
Statistics
ISBN:
9781319013387
Author:
David S. Moore, George P. McCabe, Bruce A. Craig
Publisher:
W. H. Freeman