# NOT RUN {
# Example 1
N <- 100
v <- seq(from = 0, to = 1, length.out = 10)
sig <- 2
bbridge <- simulate_iid_brownian_bridge(N, v, sig)
nlags <- 1
lagged_autocor <- obtain_autocorrelation(Y = bbridge,
nlags = nlags)
image(x = v, y = v, z = lagged_autocor$Lag0)
# }
# NOT RUN {
# Example 2
require(fields)
N <- 500
v <- seq(from = 0, to = 1, length.out = 50)
sig <- 2
bbridge <- simulate_iid_brownian_bridge(N, v, sig)
nlags <- 4
lagged_autocov <- obtain_autocovariance(Y = bbridge,
nlags = nlags)
lagged_autocor <- obtain_autocorrelation(Y = bbridge,
v = v,
nlags = nlags)
opar <- par(no.readonly = TRUE)
par(mfrow = c(1,2))
z_lims <- range(lagged_autocov$Lag1)
colors <- heat.colors(12)
image.plot(x = v,
y = v,
z = lagged_autocov$Lag1,
legend.width = 2,
zlim = z_lims,
col = colors,
xlab = "u",
ylab = "v",
main = "Autocovariance")
z_lims <- range(lagged_autocor$Lag1)
image.plot(x = v,
y = v,
z = lagged_autocor$Lag1,
legend.width = 2,
zlim = z_lims,
col = colors,
xlab = "u",
ylab = "v",
main = "Autocorrelation")
par(opar)
# }
Run the code above in your browser using DataLab