STAT 451, Day 20

Visualizing Patterns over Time

Johnson & Johnson stock price, ACF

The time series is not stationary. So there is a slowly decaying ACF.

library(astsa)
acf(jj)

plot of chunk unnamed-chunk-1

Johnson & Johnson stock price, PACF

pacf(jj)

plot of chunk unnamed-chunk-2

Johnson & Johnson stock price

Differenced to remove trend.

\[ y_t=x_t-x_{t-1} \]

jj.d <- diff(log(jj))

Johnson & Johnson stock price

Trend removed.

plot(jj.d)

plot of chunk unnamed-chunk-4

Johnson & Johnson stock price

Now we can see the seasonal part of the time series.

acf(jj.d)

plot of chunk unnamed-chunk-5

Johnson & Johnson stock price

Seasonally differenced to remove the seasonality.

\[ y_t=x_t-x_t-d \]

Where d is 4 because this is quarterly data.

jj.d <- diff(log(jj), 4)

Johnson & Johnson stock price

This looks more random.

plot(jj.d)

plot of chunk unnamed-chunk-7

Johnson & Johnson stock price

No clear pattern.

acf(jj.d)

plot of chunk unnamed-chunk-8