Vous êtes sur la page 1sur 42

Name: CIARWENA T.

PANGCOGA

Course/Section: STT 041.1 – PQ1

PROBLEMS 1 & 2 (Page 26)

1. The data set http://waveland.com/Glover-Mitchell/Problem01-OldFaithful.txt lists the time interval


(in minutes) between eruptions of Old Faithful for the entire year of 2010.

(a) Read the data into a file variable called OF.

> data.OF <- read.table("http://waveland.com/Glover-Mitchell/Problem01-OldFaithful.txt",


header = TRUE)

> data.OF

1 93.5

2 67.1

3 102.3

4 93.5

5 92.4

6 95.7

7 96.8

8 94.6

9 90.2

10 71.5

11 97.9

12 99.0

13 94.6

14 88.0

15 101.2

16 92.4

17 99.0

18 80.3

19 97.9

20 100.1
21 102.3

22 97.9

23 90.2

24 97.9

25 100.1

26 88.0

27 93.5

28 88.0

29 88.0

30 64.9

31 97.9

32 102.3

33 79.2

34 93.5

35 102.3

36 94.6

37 96.8

38 80.3

39 86.9

40 97.9

41 93.5

42 88.0

43 102.3

44 90.2

45 96.8

46 100.1

47 83.6

48 102.3

49 90.2
50 90.2

51 92.4

52 96.8

53 93.5

54 89.1

55 82.5

56 101.2

57 89.1

58 99.0

59 89.1

60 95.7

61 82.5

62 99.0

63 92.4

64 96.8

65 93.5

66 83.6

67 92.4

68 105.6

69 89.1

70 96.8

71 58.3

72 101.2

73 97.9

74 88.0

75 96.8

76 91.3

77 86.9

78 106.7
79 92.4

80 92.4

81 89.1

82 91.3

83 86.9

84 94.6

85 89.1

86 85.8

87 63.8

88 115.5

89 92.4

90 78.1

91 97.9

92 89.1

93 101.2

94 85.8

95 71.5

96 99.0

97 82.5

98 89.1

99 90.2

100 84.7

101 101.2

102 92.4

103 83.6

104 70.4

105 102.3

106 97.9

107 111.1
108 84.7

109 94.6

110 94.6

111 83.6

112 95.7

113 81.4

114 110.0

115 82.5

116 89.1

117 84.7

118 96.8

119 99.0

120 67.1

121 95.7

122 85.8

123 93.5

124 97.9

125 90.2

126 88.0

127 91.3

128 95.7

129 92.4

130 94.6

131 92.4

132 93.5

133 94.6

134 89.1

135 91.3

136 102.3
137 81.4

138 69.3

139 100.1

140 96.8

141 91.3

142 69.3

143 92.4

144 86.9

145 93.5

146 95.7

147 86.9

148 93.5

149 89.1

150 91.3

151 95.7

152 102.3

153 90.2

154 103.4

155 89.1

156 91.3

157 95.7

158 84.7

159 95.7

160 94.6

161 84.7

162 99.0

163 89.1

164 84.7

165 97.9
166 99.0

167 79.2

168 90.2

169 93.5

170 86.9

171 96.8

172 94.6

173 82.5

174 104.5

175 79.2

176 102.3

177 81.4

178 89.1

179 106.7

180 96.8

181 83.6

182 103.4

183 58.3

184 96.8

185 92.4

186 92.4

187 91.3

188 92.4

189 101.2

190 91.3

191 92.4

192 91.3

193 101.2

194 95.7
195 93.5

196 83.6

197 103.4

198 92.4

199 83.6

200 102.3

201 86.9

202 92.4

203 84.7

204 90.2

205 86.9

206 92.4

207 102.3

208 90.2

209 102.3

210 93.5

211 82.5

212 89.1

213 73.7

214 96.8

215 92.4

216 86.9

217 91.3

218 113.3

219 85.8

220 90.2

221 95.7

222 101.2

223 83.6
224 86.9

225 86.9

226 115.5

227 100.1

228 94.6

229 94.6

230 82.5

231 72.6

232 106.7

233 91.3

234 99.0

235 95.7

236 88.0

237 96.8

238 88.0

239 95.7

240 90.2

241 88.0

242 100.1

243 77.0

244 96.8

245 68.2

246 103.4

247 90.2

248 64.9

249 92.4

250 100.1

251 82.5

252 95.7
253 89.1

254 89.1

255 91.3

256 89.1

257 92.4

258 83.6

259 102.3

260 85.8

261 97.9

262 83.6

263 90.2

264 90.2

265 83.6

266 92.4

267 95.7

268 93.5

269 97.9

270 100.1

271 88.0

272 93.5

273 91.3

274 88.0

275 106.7

276 86.9

277 96.8

278 97.9

279 90.2

280 95.7

281 96.8
282 95.7

283 92.4

284 92.4

285 75.9

286 91.3

287 99.0

288 84.7

289 96.8

290 68.2

291 99.0

292 86.9

293 91.3

294 90.2

295 114.4

296 92.4

297 97.9

298 97.9

299 81.4

300 99.0

301 58.3

302 94.6

303 93.5

304 97.9

305 85.8

306 104.5

307 82.5

308 100.1

309 94.6

310 86.9
311 86.9

312 110.0

313 86.9

314 99.0

315 86.9

316 89.1

317 101.2

318 82.5

319 94.6

320 92.4

321 91.3

322 99.0

323 89.1

324 91.3

325 99.0

326 99.0

327 83.6

328 99.0

329 85.8

330 90.2

331 96.8

332 88.0

333 93.5

334 88.0

335 88.0

336 92.4

337 116.6

338 59.4

339 101.2
340 90.2

341 71.5

342 103.4

343 97.9

344 82.5

345 91.3

346 89.1

347 89.1

348 94.6

349 94.6

350 61.6

351 96.8

352 66.0

353 105.6

354 90.2

355 93.5

356 88.0

357 92.4

358 86.9

359 93.5

360 95.7

361 83.6

362 90.2

363 99.0

364 89.1

365 94.6

366 90.2

367 95.7

368 93.5
369 105.6

370 96.8

371 92.4

372 101.2

373 91.3

374 94.6

375 92.4

376 94.6

377 86.9

378 88.0

379 99.0

380 90.2

381 99.0

382 84.7

383 92.4

384 103.4

385 88.0

386 94.6

387 92.4

388 85.8

389 93.5

390 99.0

391 99.0

392 90.2

393 67.1

394 92.4

395 105.6

396 59.4

397 106.7
398 108.9

399 85.8

400 86.9

401 96.8

402 97.9

403 97.9

404 91.3

405 62.7

406 107.8

407 81.4

408 92.4

409 101.2

410 95.7

411 99.0

412 92.4

413 85.8

414 99.0

415 96.8

416 90.2

417 86.9

418 93.5

419 90.2

420 105.6

421 79.2

422 100.1

423 88.0

424 93.5

425 88.0

426 96.8
427 90.2

428 101.2

429 84.7

430 99.0

431 86.9

432 90.2

433 69.3

434 100.1

435 94.6

436 114.4

437 97.9

438 95.7

439 88.0

440 100.1

441 90.2

442 100.1

443 88.0

444 86.9

445 95.7

446 99.0

447 97.9

448 94.6

449 97.9

450 94.6

451 100.1

452 81.4

453 99.0

454 88.0

455 91.3
456 95.7

457 85.8

458 95.7

459 86.9

460 99.0

461 84.7

462 94.6

463 99.0

464 72.6

465 101.2

466 85.8

467 95.7

468 84.7

469 94.6

470 96.8

471 82.5

472 94.6

473 99.0

474 80.3

475 99.0

476 85.8

477 93.5

478 105.6

479 92.4

480 104.5

481 95.7

482 107.8

483 90.2

484 89.1
485 97.9

486 85.8

487 96.8

488 73.7

489 99.0

490 90.2

491 96.8

492 85.8

493 92.4

494 92.4

495 91.3

496 97.9

497 88.0

498 99.0

499 93.5

500 105.6

501 96.8

502 95.7

503 93.5

504 91.3

505 85.8

506 99.0

507 92.4

508 68.2

509 94.6

510 92.4

511 95.7

512 68.2

513 91.3
514 96.8

515 66.0

516 102.3

517 93.5

518 104.5

519 89.1

520 90.2

521 88.0

522 88.0

523 96.8

524 83.6

525 96.8

526 94.6

527 90.2

528 99.0

529 103.4

530 86.9

531 101.2

532 81.4

533 93.5

534 95.7

535 90.2

536 89.1

537 90.2

538 93.5

539 96.8

540 85.8

541 100.1

542 107.8
543 90.2

544 94.6

545 89.1

546 85.8

547 94.6

548 95.7

549 92.4

550 91.3

551 93.5

552 101.2

553 85.8

554 96.8

555 92.4

556 95.7

557 100.1

558 96.8

559 90.2

560 94.6

561 94.6

562 94.6

563 92.4

564 93.5

565 88.0

566 97.9

567 85.8

568 101.2

569 93.5

570 88.0

571 94.6
572 90.2

573 101.2

574 101.2

575 86.9

576 91.3

577 91.3

578 90.2

579 105.6

580 86.9

581 96.8

582 91.3

583 93.5

584 86.9

585 91.3

586 95.7

587 103.4

588 69.3

589 90.2

590 94.6

591 93.5

592 94.6

593 95.7

594 94.6

595 89.1

596 94.6

597 89.1

598 88.0

599 86.9

600 89.1
601 106.7

602 61.6

603 101.2

604 83.6

605 90.2

606 105.6

607 93.5

608 74.8

609 96.8

610 56.1

611 91.3

612 91.3

613 94.6

614 92.4

615 96.8

616 94.6

617 89.1

618 101.2

619 92.4

620 95.7

621 89.1

622 88.0

623 94.6

624 93.5

625 93.5

626 94.6

627 100.1

628 91.3

629 96.8
630 81.4

631 95.7

632 102.3

633 58.3

634 99.0

635 92.4

636 95.7

637 102.3

638 90.2

639 85.8

640 95.7

641 68.2

642 91.3

643 91.3

644 97.9

645 90.2

646 102.3

647 89.1

648 94.6

649 93.5

650 104.5

651 97.9

652 90.2

653 104.5

654 59.4

655 105.6

656 101.2

657 81.4

658 100.1
659 94.6

660 88.0

661 102.3

662 90.2

663 95.7

664 96.8

665 91.3

666 99.0

667 91.3

668 88.0

669 93.5

670 93.5

671 97.9

672 91.3

673 92.4

674 85.8

675 99.0

676 84.7

677 101.2

678 97.9

679 91.3

680 95.7

681 95.7

682 93.5

683 95.7

684 91.3

685 92.4

686 97.9

687 91.3
688 100.1

689 93.5

690 95.7

691 89.1

692 94.6

693 95.7

694 93.5

695 88.0

696 89.1

697 92.4

698 100.1

699 59.4

700 91.3

701 88.0

702 99.0

703 118.8

704 82.5

705 99.0

706 93.5

707 95.7

708 102.3

709 90.2

710 89.1

711 93.5

712 88.0

713 93.5

714 90.2

715 94.6

716 84.7
717 94.6

718 81.4

719 89.1

720 96.8

721 100.1

722 96.8

723 105.6

724 74.8

725 111.1

726 93.5

727 88.0

728 83.6

729 95.7

730 83.6

731 99.0

732 70.4

733 99.0

734 94.6

735 96.8

736 81.4

737 95.7

738 91.3

739 100.1

740 81.4

741 103.4

742 97.9

743 85.8

744 99.0

745 100.1
746 95.7

747 84.7

748 67.1

749 103.4

750 80.3

751 103.4

752 82.5

753 94.6

754 63.8

755 101.2

756 102.3

757 97.9

758 112.2

759 88.0

760 91.3

761 85.8

762 97.9

763 84.7

764 66.0

765 105.6

766 88.0

767 107.8

768 89.1

769 100.1

770 89.1

771 92.4

772 92.4

773 88.0

774 100.1
775 91.3

776 89.1

777 93.5

778 103.4

779 83.6

780 90.2

781 91.3

782 94.6

783 93.5

784 91.3

785 84.7

786 88.0

787 100.1

788 84.7

789 96.8

790 88.0

791 93.5

792 92.4

793 92.4

794 95.7

795 94.6

796 93.5

797 92.4

798 93.5

799 93.5

800 94.6

801 86.9

802 100.1

803 88.0
804 99.0

805 88.0

806 90.2

807 90.2

808 90.2

809 97.9

810 93.5

811 97.9

812 97.9

813 86.9

814 97.9

815 90.2

816 95.7

817 92.4

818 95.7

819 95.7

820 93.5

821 85.8

822 90.2

823 92.4

824 89.1

825 90.2

826 92.4

827 85.8

828 97.9

829 89.1

830 94.6

831 95.7

832 86.9
833 82.5

834 103.4

835 85.8

836 94.6

837 97.9

838 92.4

839 99.0

840 84.7

841 96.8

842 82.5

843 67.1

844 117.7

845 91.3

846 93.5

847 99.0

848 93.5

849 108.9

850 88.0

851 121.0

852 85.8

853 104.5

854 90.2

855 100.1

856 86.9

857 113.3

858 88.0

859 104.5

860 83.6

861 93.5
862 85.8

863 100.1

864 86.9

865 89.1

866 92.4

867 84.7

868 95.7

869 94.6

870 94.6

871 89.1

872 91.3

873 90.2

874 84.7

875 118.8

876 86.9

877 93.5

878 97.9

879 92.4

880 96.8

881 92.4

882 92.4

883 93.5

884 88.0

885 84.7

886 86.9

887 95.7

888 86.9

889 95.7

890 89.1
891 94.6

892 106.7

893 84.7

894 93.5

895 97.9

896 95.7

897 97.9

898 94.6

899 94.6

900 108.9

901 90.2

902 96.8

903 90.2

904 85.8

905 92.4

906 83.6

907 89.1

908 99.0

909 83.6

910 104.5

911 96.8

912 85.8

913 96.8

914 105.6

915 83.6

916 112.2

917 77.0

918 93.5

919 62.7
920 101.2

921 88.0

922 95.7

923 93.5

924 92.4

925 86.9

926 110.0

927 78.1

928 92.4

929 92.4

930 81.4

931 91.3

932 88.0

933 90.2

934 89.1

935 105.6

936 85.8

937 91.3

938 88.0

939 113.3

940 92.4

941 91.3

942 92.4

943 101.2

944 88.0

945 94.6

946 82.5

947 88.0

948 94.6
949 100.1

950 88.0

951 93.5

952 91.3

953 84.7

954 112.2

955 88.0

956 97.9

957 94.6

958 94.6

959 92.4

960 88.0

961 107.8

962 92.4

963 95.7

964 94.6

965 91.3

966 91.3

967 101.2

968 82.5

969 89.1

970 95.7

971 89.1

972 103.4

973 88.0

974 97.9

975 91.3

976 96.8

977 85.8
978 97.9

979 92.4

980 101.2

981 85.8

982 97.9

983 88.0

984 96.8

985 95.7

986 85.8

987 95.7

988 93.5

989 100.1

990 100.1

991 86.9

992 86.9

993 92.4

994 100.1

995 93.5

996 83.6

997 92.4

998 93.5

999 101.2

1000 86.9

[ reached 'max' / getOption("max.print") -- omitted 4699 rows ]

(b) How many eruptions were there in 2010? What function in R can you use to determine this?

> length(data.OF$Interval)

[1] 5699

(c) Create a five-number summary of the data.


> fivenum(data.OF$Interval)

[1] 50.6 88.0 93.5 97.9 125.4

(d) What were the shortest and longest times between eruptions in 2010?

> max(data.OF$Interval)

[1] 125.4

> min(data.OF$Interval)

[1] 50.6

(e) Compare the median and mean times between 2010 eruptions.

> mean(data.OF$Interval)

[1] 92.25225

> median(data.OF$Interval)

[1] 93.5

(f) Create a histogram for these data. Label the plot “Distribution of Eruption Intervals for Old Faithful,
2010.” Label the x-axis as “Minutes between eruptions.”

> hist(data.OF$Interval)

> hist(data.OF$Interval, breaks = seq(50, 130, by = 5), main = "Distribution of Eruption Intervals
for Old Faithful, 2010",xlab = "Minutes between eruptions", xaxt = 'n')

> axis(side = 1, at = seq(50, 130, by = 10), labels = seq(50, 130, by = 10))


(g) Create a box plot for these data.

> boxplot(data.OF$Interval)

> boxplot(data.OF$Interval, main = "Eruption Intervals", ylab ="Intervals")

(h) Find the variance and standard deviation for the eruption intervals.

> var(data.OF$Interval)
[1] 86.32804

> sd(data.OF$Interval)

[1] 9.291288

2. Return to data set http://waveland.com/Glover-Mitchell/Problem00-3.txt that lists the monthly


snowfall for Buffalo, NY for each snow season from 1940–41 to 2013–

14.

(a) Print the first and last few rows of the data set.

> head(data.2)

SEASON JUL AUG SEP OCT NOV DEC JAN FEB MAR APR MAY JUN ANNUAL

1 1940-41 0 0 0 0.0 17.5 12.1 17.3 23.1 9.3 0.0 0 0 79.3

2 1941-42 0 0 0 0.0 5.0 7.8 31.0 28.0 13.7 4.1 0 0 89.6

3 1942-43 0 0 0 0.0 8.7 26.7 16.9 17.7 10.4 5.1 0 0 85.5

4 1943-44 0 0 0 1.5 13.6 1.7 3.4 24.6 10.5 2.7 0 0 58.0

5 1944-45 0 0 0 0.0 3.9 35.1 50.6 23.3 5.8 0.0 2 0 120.7

6 1945-46 0 0 0 0.0 25.2 51.1 10.7 23.5 0.0 0.0 0 0 110.5

> tail(data.2)

SEASON JUL AUG SEP OCT NOV DEC JAN FEB MAR APR MAY JUN ANNUAL

69 2008-09 0 0 0 0.1 6.2 49.2 30.6 11.6 0.5 2.0 0 0 100.2

70 2009-10 0 0 0 0.0 0.0 25.1 35.6 13.4 0.0 0.0 0 0 74.1

71 2010-11 0 0 0 0.0 1.6 32.0 29.8 34.1 13.3 1.0 0 0 111.8

72 2011-12 0 0 0 0.0 0.0 3.8 20.8 9.6 1.5 1.0 0 0 36.7

73 2012-13 0 0 0 0.0 2.4 19.6 6.2 20.5 9.8 0.3 0 0 58.8

74 2013-14 0 0 0 0.0 10.0 28.5 42.4 23.3 24.5 1.2 0 0 129.9 (b) Create a five-number
summary of the annual snowfall data.

> fivenum(data.2$ANNUAL)

[1] 36.70 71.50 91.35 110.50 199.40

(c) Compare the median and mean annual snowfalls for this period

> mean(data.2$ANNUAL)

[1] 92.57838
> median(data.2$ANNUAL)

[1] 91.35

(d) Create a histogram of the annual snowfall data. Label the plot “Annual Snowfall Distribution, Buffalo,
NY” Label the x-axis as “Inches.”

> hist(data.2$ANNUAL)

> hist(data.2$ANNUAL, main="Annual Snowfall Distribution, Buffalo, NY", xlab="Inches")

(e) Create a box plot of the annual snowfall data. Use appropriate labels.

> boxplot(data.2$ANNUAL)
> boxplot(data.2$ANNUAL, main="Annual Snowfall Distribution, Buffalo, NY", xlab="Inches")

(f ) Find the variance and standard deviation for the annual snowfall data.

> var(data.2$ANNUAL)

[1] 818.8256

> sd(data.2$ANNUAL)

[1] 28.61513

(g) Create side-by-side box plots of the monthly snowfalls for November, December, January, and
February.

> boxplot(data.2$NOV)
> boxplot(data.2$DEC)

> boxplot(data.2$JAN)

> boxplot(data.2$NOV, data.2$DEC, data.2$JAN,data.2$FEB, main="Annual Snowfall


Distribution", ylab="inches", names=c("NOV","DEC", "JAN", "FEB"))

Vous aimerez peut-être aussi