In: Math
In 2014, a group of students was interested in investigating prices of rental accommodation in suburbs of Brisbane that are close to the CBD and collected information on a total of 200 randomly chosen dwellings in four inner western suburbs. A subset of this data, relating to rental apartments in these suburbs is included below. The variables are:
Per week: weekly rental price for the apartment ($);
Bedrooms: number of bedrooms in the apartment;
Sqm: size of the apartment (m2)
Furnished: whether the apartment was furnished or not (yes/no).
The values are;
265,2,59,No
305,2,70,No
300,1,72,No
320,3,66,No
340,2,113,Yes
330,2,58,Yes
355,2,63,No
345,2,57,Yes
355,2,61,No
360,2,114,Yes
355,2,75,Yes
360,2,68,No
365,2,64,No
370,1,69,No
390,2,73,Yes
380,2,85,Yes
390,2,56,Yes
370,2,56,Yes
385,2,59,Yes
380,2,65,Yes
385,2,62,Yes
400,2,65,No
415,2,69,Yes
400,3,63,No
405,3,70,No
420,2,77,No
435,2,84,Yes
435,2,83,Yes
455,2,73,Yes
450,2,72,Yes
485,2,68,No
500,2,76,Yes
535,2,97,No
290,1,60,No
305,1,63,Yes
330,2,65,No
310,2,70,No
335,2,64,No
330,2,62,No
345,2,79,No
355,1,81,No
340,2,66,No
345,1,60,No
345,2,64,No
355,2,73,No
385,2,61,No
380,2,78,No
405,2,81,No
410,2,76,Yes
430,2,80,No
440,2,61,No
450,3,86,No
485,3,91,No
500,1,87,No
545,1,97,Yes
345,3,86,No
400,2,72,No
400,2,74,No
480,2,73,Yes
755,3,87,No
760,3,77,No
770,3,113,No
824,2,109,No
860,3,104,No
295,1,70,No
290,1,54,No
295,1,61,No
325,1,61,No
340,2,56,No
355,2,61,No
365,2,95,No
420,1,75,No
420,2,66,No
440,2,74,No
480,3,72,No
465,3,87,No
470,1,87,Yes
490,1,81,Yes
495,2,76,No
505,2,97,No
530,2,77,No
545,2,97,No
560,2,79,No
550,2,78,No
560,3,75,No
565,1,96,Yes
580,2,85,Yes
605,3,84,No
605,2,93,Yes
610,2,78,Yes
620,2,87,No
665,2,88,No
700,2,80,No
750,3,97,Yes
740,3,124,No
805,3,101,No
860,3,98,No
960,3,123,Yes
990,3,102,Yes
1195,3,133,No
1190,3,137,No
1405,3,148,Yes
1490,3,154,No
Question 3)
The students were interested in the proportion of rental apartments in these suburbs that were leased as furnished apartments, and whether this varied with the number of bedrooms in these apartments. To investigate further whether the proportions of furnished apartments differ between apartments with different numbers of bedrooms, it is useful to test formally whether the number of bedrooms in an apartment and whether it is furnished or not are independent.
a) Test whether the number of bedrooms in an apartment and whether it is furnished or not is independent.
b) State the null hypothesis, the relevant form of the test statistic and the approximate distribution of the test statistic for carrying out this text.
c) Perform a hypothesis test with using α = 0.05, of whether the proportions of furnished apartments vary across number of bedrooms, that is, whether the furnishing status of an apartment is independent of the number of bedrooms in the apartment.
Include the Following:
i) The table of expected frequencies
ii) The observed value of the test statistic
iii) The relevant degrees of freedom for the distribution of the test statistic
IV) The resulting p-value for the test, or a rejection region
Conclude the test by interpreting the p-value (or rejection region and your observed test statistic) in terms of the original question discussed above
Pls do this question with R code !!!!
Part (a)
To Test whether the number of bedrooms in an apartment and whether it is furnished or not
are independent, as a first preparatory step, we construct the following (3 x 2) contingency table:
Number of Bedrooms |
Furnished |
Not Furnished |
Total |
1 |
5 |
11 |
16 |
2 |
23 |
48 |
63 |
3 |
4 |
20 |
24 |
Total |
32 |
71 |
103 |
DONE
Part (b)
Hypotheses
Null H0: The number of bedrooms in an apartment and whether it is furnished or not are independent, Vs
Alternative H1: The two attributes are not independent
Test Statistic
χ2 = ∑(i = 1 to r, j = 1 to c){(Oij - Eij)2/Eij}, where Oij and Eij are respectively, the observed and the expected frequencies of the ijth cell, r =number of rows and c = number of columns of the contingency table.
Distribution
Under H0, χ2 ~ χ2n = 2, where n = {(r - 1)(s - 1)}
DONE
Part (c)
Calculations Summary
χ2cal = |
3.195048 |
p-value = |
0.202397 |
||
χ2crit = |
5.991465 |
for DF = |
2 |
α = |
0.05 |
Since χ2cal < χ2crit, H0 is accepted. [Equivalently, H0 is accepted since p-value > α ]
Conclusion
There is sufficient evidence to suggest that whether an apartment is furnished or not does not depend on the number of bedrooms in the apartment.
DONE
Calculations Details
Oij (given) |
|||
Oi1 |
O12 |
Oi. |
|
O1i |
5 |
11 |
16 |
O2j |
23 |
40 |
63 |
O3j |
4 |
20 |
24 |
O.i |
32 |
71 |
103 |
Eij |
|||
Ei1 |
Ei2 |
Ei. |
|
E1j |
4.970874 |
11.02912621 |
16 |
E2j |
19.57282 |
43.42718447 |
63 |
E3j |
7.456311 |
16.54368932 |
24 |
E.i |
32 |
71 |
103 |
chi-square |
|||
1 |
2 |
Total |
|
1 |
0.000171 |
7.69178E-05 |
0.000248 |
2 |
0.600097 |
0.27046638 |
0.870564 |
3 |
1.602144 |
0.722093076 |
2.324237 |
Total |
2.202412 |
0.992636374 |
3.195048 |