Hedge Fund Index

CISDM Equal Weighted Hedge Fund Index NAV, Monthly, 1990 - Present

# Remove earlier time points
data <- read.csv("http://ptrckprry.com/course/forecasting/data/hedge.csv")
data$date <- as.Date(data$date)
data <- subset(data, date >= "1990-01-01")

# Extract returns
hedge <- data$return
n <- length(hedge)
time <- 1:n
plot(time, hedge, type="l", col=1)

White Noise

wn <- rnorm(n)
plot(time, wn, type="l", col=2)

MA(1)

beta <- 0.25
ma1 <- filter(wn, c(1, beta), method="convolution", sides=1)
plot(time, ma1, type="l", col=3)

AR(1)

alpha <- 0.3
ar1 <- filter(wn, alpha, method="recursive")
plot(time, ar1, type="l", col=4)

All Four Series

par(mfrow=c(2,2))
plot(time, hedge, type="l", col=1)
plot(time, wn, type="l", col=2)
plot(time, ma1, type="l", col=3)
plot(time, ar1, type="l", col=4)

Lagging

lagpad <- function(x, k) {
    c(rep(NA, k), x)[1:length(x)]
}

Lag Plot for Hedge

plot(lagpad(hedge, 1), hedge, col=1, asp=1)
abline(lm(hedge ~ lagpad(hedge, 1)), lty=2)

Lag Plots for All Four

par(mfrow=c(2,2))

plot(lagpad(hedge, 1), hedge, col=1, asp=1)
abline(lm(hedge ~ lagpad(hedge, 1)), lty=2)

plot(lagpad(wn, 1), wn, col=2, asp=1)
abline(lm(wn ~ lagpad(wn, 1)), lty=2)

plot(lagpad(ma1, 1), ma1, col=3, asp=1)
abline(lm(ma1 ~ lagpad(ma1, 1)), lty=2)

plot(lagpad(ar1, 1), ar1, col=4, asp=1)
abline(lm(ar1 ~ lagpad(ar1, 1)), lty=2)

Lag-2 Plots for All Four

par(mfrow=c(2,2))

plot(lagpad(hedge, 2), hedge, col=1, asp=1)
abline(lm(hedge ~ lagpad(hedge, 2)), lty=2)

plot(lagpad(wn, 2), wn, col=2, asp=1)
abline(lm(wn ~ lagpad(wn, 2)), lty=2)

plot(lagpad(ma1, 2), ma1, col=3, asp=1)
abline(lm(ma1 ~ lagpad(ma1, 2)), lty=2)

plot(lagpad(ar1, 2), ar1, col=4, asp=1)
abline(lm(ar1 ~ lagpad(ar1, 2)), lty=2)

Lag Plots for Hedge

lag.plot <- function(x, lag, col) {
    model <- lm(x ~ lagpad(x, lag))
    rho <- cor(x, lagpad(x, lag), use="complete.obs")
    plot(lagpad(x, lag), x, col=col, asp=1,
         main = paste("cor =", round(rho, 2)))
    abline(model, lty=2)
}

lag.plots <- function(x, col) {
    par(mfrow=c(2,2))
    lag.plot(x, 1, col)
    lag.plot(x, 2, col)
    lag.plot(x, 3, col)
    lag.plot(x, 4, col)
}

lag.plots(hedge, col=1)

Lag Plots for White Noise

lag.plots(wn, col=2)

Lag Plots for MA(1)

lag.plots(ma1, col=3)

Lag Plots for AR(1)

lag.plots(ar1, col=4)

Autocorrelation function for Hedge

library("forecast")
Loading required package: zoo

Attaching package: 'zoo'
The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
Loading required package: timeDate
Loading required package: methods
This is forecast 7.3 
Acf(hedge)

Autocorrelation function for White Noise

Acf(wn)

Autocorrelation function for MA(1)

Acf(ma1)

Autocorrelation function for AR(1)

Acf(ar1)

ACF for All Four

par(mfrow=c(2,2))
Acf(hedge)
Acf(wn)
Acf(ma1)
Acf(ar1)