Class Web Page



1. Random Sample

In Applied Statistics course, you learned couple of formulas for basic statistical inference: \[ \mbox{Assuming } X_1, \ldots, X_n \mbox{ are RS (i.i.d) from } N(\mu, \sigma) \mbox{distribution}\\ \hspace{10mm}\\ \hspace{10mm}\\ 95\% \mbox{ Confidence Interval for mean } \mu: \hspace{15mm} \bar X \pm 1.96 \frac{S}{\sqrt n}\\ \hspace{10mm}\\ 95\% \mbox{ Prediction Interval for the next observation} : \hspace{15mm} \bar X \pm 1.96 \, S \, \sqrt{\frac{1}{n} + 1} \]


Let’s simulate that using R. Random Sample of size 100 from the normal distribution with mean 2 and SD 2 looks like this:



2. Example of Time Series

First, let’s load the package called TSA this is the package that comes with Cryer’s textbook.


LA rainfall (p2)

Now load the data that comes with TSA package. Here’s the data for annual rain falls in LA.

## [1] TRUE
## Time Series:
## Start = 1878 
## End = 1992 
## Frequency = 1 
##   [1] 20.86 17.41 18.65  5.53 10.74 14.14 40.29 10.53 16.72 16.02 20.82 33.26 12.69
##  [14] 12.84 18.72 21.96  7.51 12.55 11.80 14.28  4.83  8.69 11.30 11.96 13.12 14.77
##  [27] 11.88 19.19 21.46 15.30 13.74 23.92  4.89 17.85  9.78 17.17 23.21 16.67 23.29
##  [40]  8.45 17.49  8.82 11.18 19.85 15.27  6.25  8.11  8.94 18.56 18.63  8.69  8.32
##  [53] 13.02 18.93 10.72 18.76 14.67 14.49 18.24 17.97 27.16 12.06 20.26 31.28  7.40
##  [66] 22.57 17.45 12.78 16.22  4.13  7.59 10.63  7.38 14.33 24.95  4.08 13.69 11.89
##  [79] 13.62 13.24 17.49  6.23  9.57  5.83 15.37 12.31  7.98 26.81 12.91 23.66  7.58
##  [92] 26.32 16.54  9.26  6.54 17.45 16.69 10.70 11.01 14.97 30.57 17.00 26.33 10.92
## [105] 14.41 34.04  8.90  8.92 18.00  9.11 11.57  4.56  6.49 15.07 22.65


Chemical Process (p3)

Here’s color peoperty of a chemicals mixed in a plant.


Abundance of Canadian Hare (p5)

Here’s annual population of rabbits in Canada


Monthly Oil Filter Sales (p7)

Sales for oil filters

## [1] TRUE
##       Jan  Feb  Mar  Apr  May  Jun  Jul  Aug  Sep  Oct  Nov  Dec
## 1983                               2385 3302 3958 3302 2441 3107
## 1984 5862 4536 4625 4492 4486 4005 3744 2546 1954 2285 1778 3222
## 1985 5472 5310 1965 3791 3622 3726 3370 2535 1572 2146 2249 1721
## 1986 5357 5811 2436 4608 2871 3349 2909 2324 1603 2148 2245 1586
## 1987 5332 5787 2886 5475 3843 2537



Summary

  • What is the key difference between Time Series and Random Sample?
  • How do you check if a data is random sample, and not time series?