Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me..!! Question 1 – Real Estate The dataset RealState includes two r

ID: 3172848 • Letter: P

Question

Please help me..!!

Question 1 – Real Estate
The dataset RealState includes two random samples of 100 listings each that have been extracted from
a much larger original dataset. One sample has houses with fireplaces and the other has houses without
fireplaces. The spreadsheet also has: Price ($), Living Area (sq. ft.), and Age (years) for each listing.
a) Describe, in one short phrase each, the populations being examined.
b) Carry out a hypothesis test to see whether there is a real difference in the mean price of these two
populations. Assume the two population variances are unequal.
Note: The level of significance is not specified. Draw your conclusions by referring to the strength of
evidence indicated by the p-value. Remember the three alpha values most commonly used: 0.05 =
statistically significant, 0.01 = highly statistically significant, and 0.001 = very highly statistically
significant.
c) Find the corresponding 95% confidence interval for the difference in mean house prices.
d) Describe in one sentence how the hypothesis test in part b) and the confidence interval in part c)
reflect the relationship between confidence intervals and hypothesis tests as introduced in class.

Spreadsheet below..

Price ($)

Living Area (sq ft)

Age (years)

Fireplace

1

171171

1822

12

0

2

136499

1152

36

0

3

87852

1270

110

0

4

92436

1300

10

0

5

216018

1216

75

0

6

165213

1664

10

0

7

104371

1463

125

0

8

104984

1184

21

0

9

150909

1374

44

0

10

110738

1800

83

0

11

120476

1248

14

0

12

168739

1620

0

0

13

147625

1668

16

0

14

149078

1664

14

0

15

115566

1184

17

0

16

123064

1209

73

0

17

90446

1200

10

0

18

57678

924

104

0

19

102003

1184

20

0

20

87852

976

23

0

21

84291

924

15

0

22

155787

1540

16

0

23

147634

864

39

0

24

60238

1664

76

0

25

111546

1560

31

0

26

185323

1662

0

0

27

262461

2809

2

0

28

107306

1276

29

0

29

172795

1910

21

0

30

98652

1158

14

0

31

107743

1184

18

0

32

161923

1158

7

0

33

100839

1480

17

0

34

95708

912

20

0

35

111809

1711

112

0

36

91386

1120

14

0

37

92519

1368

34

0

38

146626

1561

18

0

39

111221

1056

27

0

40

153850

2400

26

0

41

131165

1564

13

0

42

110963

1568

18

0

43

119784

1560

25

0

44

130782

1274

14

0

45

122257

1400

17

0

46

283851

2346

1

0

47

263408

1738

5

0

48

87588

1392

17

0

49

102806

1168

21

0

50

97476

1219

19

0

51

135167

1610

17

0

52

54210

792

55

0

53

101227

1754

110

0

54

137681

1728

12

0

55

112153

1834

65

0

56

224888

1200

65

0

57

236215

1392

4

0

58

119751

1480

17

0

59

130574

1600

57

0

60

103633

1314

21

0

61

93846

1385

17

0

62

120115

967

55

0

63

116321

1486

16

0

64

111534

1032

4

0

65

113444

1656

94

0

66

137540

1551

97

0

67

111264

1142

18

0

68

133067

1326

7

0

69

146611

1580

26

0

70

115649

1422

20

0

71

111436

1380

2

0

72

94064

912

37

0

73

103672

1476

6

0

74

64552

1298

106

0

75

166222

1498

10

0

76

109578

1176

5

0

77

139104

1760

135

0

78

93174

1022

55

0

79

98632

1406

19

0

80

168497

1888

6

0

81

108785

1480

22

0

82

106524

1148

7

0

83

88092

929

22

0

84

136551

1880

7

0

85

152822

1043

104

0

86

157411

1666

2

0

87

167145

1852

16

0

88

122082

2256

124

0

89

115401

1480

18

0

90

124939

1099

9

0

91

55817

1688

119

0

92

74422

2708

21

0

93

200793

1940

9

0

94

155488

1747

1

0

95

94405

1375

22

0

96

98389

1184

18

0

97

102086

1302

16

0

98

180927

2050

33

0

99

59003

3285

233

0

100

79893

2634

83

0

101

152404

1508

16

1

102

135011

1327

35

1

103

82556

1480

14

1

104

233876

2434

20

1

105

247839

1536

66

1

106

156530

1734

29

1

107

180032

2066

32

1

108

132311

1512

13

1

109

196846

2144

19

1

110

254944

2579

0

1

111

127740

1480

16

1

112

263226

3355

1

1

113

278936

3121

0

1

114

152491

1875

31

1

115

164419

1785

1

1

116

171885

1536

7

1

117

189654

2320

16

1

118

260460

3726

3

1

119

219262

2327

10

1

120

259999

2577

1

1

121

206688

2284

17

1

122

215824

2056

2

1

123

154314

1466

62

1

124

176846

2249

1

1

125

253433

3021

21

1

126

138297

1800

49

1

127

254327

2541

5

1

128

160007

1665

27

1

129

297024

3020

2

1

130

128273

1343

15

1

131

120639

1498

0

1

132

237367

2936

6

1

133

207347

2119

14

1

134

112825

1314

20

1

135

139418

1296

51

1

136

229055

2500

0

1

137

202751

2202

6

1

138

234954

2294

0

1

139

329484

2786

0

1

140

261846

2772

0

1

141

189836

1726

26

1

142

69814

840

57

1

143

246976

1652

4

1

144

103408

1034

14

1

145

145147

1832

47

1

146

102806

1248

46

1

147

267731

3001

0

1

148

136192

1623

36

1

149

387652

3504

0

1

150

149933

1664

25

1

151

135820

1475

20

1

152

257015

2093

1

1

153

162612

1348

11

1

154

142302

1242

2

1

155

148585

1734

34

1

156

189736

2588

31

1

157

240872

2348

7

1

158

144335

1274

20

1

159

236737

3239

1

1

160

106524

1144

16

1

161

251699

3081

1

1

162

354739

3982

6

1

163

163524

2516

40

1

164

170600

1728

0

1

165

214749

2286

11

1

166

93895

1480

17

1

167

194880

2278

0

1

168

85560

2068

104

1

169

218475

2748

0

1

170

174208

2372

2

1

171

98790

1480

16

1

172

251259

1932

0

1

173

261647

1850

16

1

174

224928

2185

14

1

175

126311

1370

27

1

176

261011

3015

1

1

177

277235

2950

1

1

178

144561

1292

4

1

179

170534

1820

18

1

180

157081

2310

33

1

181

185902

2756

33

1

182

113740

1920

34

1

183

130239

1052

15

1

184

207018

2147

9

1

185

94064

1480

16

1

186

230708

2548

3

1

187

103861

1700

25

1

188

247520

2445

18

1

189

207751

2628

20

1

190

120476

2238

114

1

191

198622

2024

25

1

192

233714

2338

16

1

193

122796

1612

34

1

194

102806

1480

15

1

195

217314

2498

14

1

196

379678

3720

0

1

197

140602

1693

26

1

198

184108

2702

31

1

199

141029

1874

31

1

200

314912

3423

0

1

Price ($)

Living Area (sq ft)

Age (years)

Fireplace

1

171171

1822

12

0

2

136499

1152

36

0

3

87852

1270

110

0

4

92436

1300

10

0

5

216018

1216

75

0

6

165213

1664

10

0

7

104371

1463

125

0

8

104984

1184

21

0

9

150909

1374

44

0

10

110738

1800

83

0

11

120476

1248

14

0

12

168739

1620

0

0

13

147625

1668

16

0

14

149078

1664

14

0

15

115566

1184

17

0

16

123064

1209

73

0

17

90446

1200

10

0

18

57678

924

104

0

19

102003

1184

20

0

20

87852

976

23

0

21

84291

924

15

0

22

155787

1540

16

0

23

147634

864

39

0

24

60238

1664

76

0

25

111546

1560

31

0

26

185323

1662

0

0

27

262461

2809

2

0

28

107306

1276

29

0

29

172795

1910

21

0

30

98652

1158

14

0

31

107743

1184

18

0

32

161923

1158

7

0

33

100839

1480

17

0

34

95708

912

20

0

35

111809

1711

112

0

36

91386

1120

14

0

37

92519

1368

34

0

38

146626

1561

18

0

39

111221

1056

27

0

40

153850

2400

26

0

41

131165

1564

13

0

42

110963

1568

18

0

43

119784

1560

25

0

44

130782

1274

14

0

45

122257

1400

17

0

46

283851

2346

1

0

47

263408

1738

5

0

48

87588

1392

17

0

49

102806

1168

21

0

50

97476

1219

19

0

51

135167

1610

17

0

52

54210

792

55

0

53

101227

1754

110

0

54

137681

1728

12

0

55

112153

1834

65

0

56

224888

1200

65

0

57

236215

1392

4

0

58

119751

1480

17

0

59

130574

1600

57

0

60

103633

1314

21

0

61

93846

1385

17

0

62

120115

967

55

0

63

116321

1486

16

0

64

111534

1032

4

0

65

113444

1656

94

0

66

137540

1551

97

0

67

111264

1142

18

0

68

133067

1326

7

0

69

146611

1580

26

0

70

115649

1422

20

0

71

111436

1380

2

0

72

94064

912

37

0

73

103672

1476

6

0

74

64552

1298

106

0

75

166222

1498

10

0

76

109578

1176

5

0

77

139104

1760

135

0

78

93174

1022

55

0

79

98632

1406

19

0

80

168497

1888

6

0

81

108785

1480

22

0

82

106524

1148

7

0

83

88092

929

22

0

84

136551

1880

7

0

85

152822

1043

104

0

86

157411

1666

2

0

87

167145

1852

16

0

88

122082

2256

124

0

89

115401

1480

18

0

90

124939

1099

9

0

91

55817

1688

119

0

92

74422

2708

21

0

93

200793

1940

9

0

94

155488

1747

1

0

95

94405

1375

22

0

96

98389

1184

18

0

97

102086

1302

16

0

98

180927

2050

33

0

99

59003

3285

233

0

100

79893

2634

83

0

101

152404

1508

16

1

102

135011

1327

35

1

103

82556

1480

14

1

104

233876

2434

20

1

105

247839

1536

66

1

106

156530

1734

29

1

107

180032

2066

32

1

108

132311

1512

13

1

109

196846

2144

19

1

110

254944

2579

0

1

111

127740

1480

16

1

112

263226

3355

1

1

113

278936

3121

0

1

114

152491

1875

31

1

115

164419

1785

1

1

116

171885

1536

7

1

117

189654

2320

16

1

118

260460

3726

3

1

119

219262

2327

10

1

120

259999

2577

1

1

121

206688

2284

17

1

122

215824

2056

2

1

123

154314

1466

62

1

124

176846

2249

1

1

125

253433

3021

21

1

126

138297

1800

49

1

127

254327

2541

5

1

128

160007

1665

27

1

129

297024

3020

2

1

130

128273

1343

15

1

131

120639

1498

0

1

132

237367

2936

6

1

133

207347

2119

14

1

134

112825

1314

20

1

135

139418

1296

51

1

136

229055

2500

0

1

137

202751

2202

6

1

138

234954

2294

0

1

139

329484

2786

0

1

140

261846

2772

0

1

141

189836

1726

26

1

142

69814

840

57

1

143

246976

1652

4

1

144

103408

1034

14

1

145

145147

1832

47

1

146

102806

1248

46

1

147

267731

3001

0

1

148

136192

1623

36

1

149

387652

3504

0

1

150

149933

1664

25

1

151

135820

1475

20

1

152

257015

2093

1

1

153

162612

1348

11

1

154

142302

1242

2

1

155

148585

1734

34

1

156

189736

2588

31

1

157

240872

2348

7

1

158

144335

1274

20

1

159

236737

3239

1

1

160

106524

1144

16

1

161

251699

3081

1

1

162

354739

3982

6

1

163

163524

2516

40

1

164

170600

1728

0

1

165

214749

2286

11

1

166

93895

1480

17

1

167

194880

2278

0

1

168

85560

2068

104

1

169

218475

2748

0

1

170

174208

2372

2

1

171

98790

1480

16

1

172

251259

1932

0

1

173

261647

1850

16

1

174

224928

2185

14

1

175

126311

1370

27

1

176

261011

3015

1

1

177

277235

2950

1

1

178

144561

1292

4

1

179

170534

1820

18

1

180

157081

2310

33

1

181

185902

2756

33

1

182

113740

1920

34

1

183

130239

1052

15

1

184

207018

2147

9

1

185

94064

1480

16

1

186

230708

2548

3

1

187

103861

1700

25

1

188

247520

2445

18

1

189

207751

2628

20

1

190

120476

2238

114

1

191

198622

2024

25

1

192

233714

2338

16

1

193

122796

1612

34

1

194

102806

1480

15

1

195

217314

2498

14

1

196

379678

3720

0

1

197

140602

1693

26

1

198

184108

2702

31

1

199

141029

1874

31

1

200

314912

3423

0

1

Explanation / Answer

We shall analyse this using the open source statistical package R , the complete R snippet for the analysis is

####

# read the data into R dataframe
data.df<- read.csv("C:\Users\586645\Downloads\Chegg\property.csv",header=TRUE)
str(data.df)

data.df$Price....<- as.numeric(data.df$Price....)

# seperate the data into 2 parts
fireplace <- data.df[which(data.df$Fireplace==1),]
nofireplace <- data.df[which(data.df$Fireplace==0),]

# question 1
summary(fireplace)
summary(nofireplace)

# perform a t test on the price

t.test(fireplace$Price....,nofireplace$Price....)

## 95% confidence interval of mean , we use z = 1.95 for alpha = 0.05

mean(fireplace$Price....) + 1.96*sd(fireplace$Price....) # upper
mean(fireplace$Price....) - 1.96*sd(fireplace$Price....) # lower


mean(nofireplace$Price....) + 1.96*sd(nofireplace$Price....) # upper
mean(nofireplace$Price....) - 1.96*sd(nofireplace$Price....) # lower

####

The results are

> data.df<- read.csv("C:\Users\586645\Downloads\Chegg\property.csv",header=TRUE)
> str(data.df)
'data.frame':   200 obs. of 4 variables:
$ Price.... : Factor w/ 195 levels "100839","101227",..: 99 55 177 183 123 92 10 11 76 17 ...
$ Living.Area..sq.ft.: int 1822 1152 1270 1300 1216 1664 1463 1184 1374 1800 ...
$ Age..years. : int 12 36 110 10 75 10 125 21 44 83 ...
$ Fireplace : int 0 0 0 0 0 0 0 0 0 0 ...
>
> data.df$Price....<- as.numeric(data.df$Price....)
>
> # seperate the data into 2 parts
> fireplace <- data.df[which(data.df$Fireplace==1),]
> nofireplace <- data.df[which(data.df$Fireplace==0),]
>
> # question 1
> summary(fireplace)
Price.... Living.Area..sq.ft. Age..years. Fireplace
Min. : 5.00 Min. : 840 Min. : 0.00 Min. :1
1st Qu.: 67.75 1st Qu.:1530 1st Qu.: 2.00 1st Qu.:1
Median :113.50 Median :2067 Median : 15.00 Median :1
Mean :106.09 Mean :2112 Mean : 18.16 Mean :1
3rd Qu.:142.25 3rd Qu.:2543 3rd Qu.: 26.25 3rd Qu.:1
Max. :195.00 Max. :3982 Max. :114.00 Max. :1
> summary(nofireplace)
Price.... Living.Area..sq.ft. Age..years. Fireplace
Min. : 1.00 Min. : 792 Min. : 0.00 Min. :0
1st Qu.: 29.75 1st Qu.:1184 1st Qu.: 12.75 1st Qu.:0
Median : 73.00 Median :1414 Median : 18.50 Median :0
Mean : 87.47 Mean :1485 Mean : 35.47 Mean :0
3rd Qu.:165.25 3rd Qu.:1664 3rd Qu.: 40.25 3rd Qu.:0
Max. :194.00 Max. :3285 Max. :233.00 Max. :0

The mean price for the house with no fireplace is 87.47 while with fireplace is 106.7 . This also provides the 5 point summary statitics for the houses of the 2 populations characterised by fireplaces


>
> # perform a t test on the price
>
> t.test(fireplace$Price....,nofireplace$Price....)

   Welch Two Sample t-test

data: fireplace$Price.... and nofireplace$Price....
t = 2.3215, df = 179.09, p-value = 0.02139 , as th ep value of the test is less than 0.05 , hence the test is only STATISTICALLY SIGNIFICANT and there is indeed a difference in the average prices of the properties for the 2 groups , characterised by presence and absence of fireplaces


alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
2.792616 34.447384
sample estimates:
mean of x mean of y
106.09 87.47

>
> ## the upper and lower limit of the confidence interval is calculated using the equation

mean +- z* SD , here the Z is 1.96 , assuming alpha =0.05 from the z table

> ## 95% confidence interval of mean , we use z = 1.95 for alpha = 0.05
>
> mean(fireplace$Price....) + 1.96*sd(fireplace$Price....) # upper
[1] 197.4247
> mean(fireplace$Price....) - 1.96*sd(fireplace$Price....) # lower
[1] 14.75533
>
>
> mean(nofireplace$Price....) + 1.96*sd(nofireplace$Price....) # upper
[1] 215.4234
> mean(nofireplace$Price....) - 1.96*sd(nofireplace$Price....) # lower
[1] -40.48343

d)

while confidence intervals gives the range of the values that would contain the TRUE MEAN of the prices for the 2 groups , the t test help us compare whether the difference between the 2 property types is just by chance or by a effect which we need to explore

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote