# Generate example data with AR(1) structure
n_time <- 200
n_voxels <- 50
phi_true <- 0.5
# Simulate residuals with AR(1) structure
resid <- matrix(0, n_time, n_voxels)
for (v in 1:n_voxels) {
e <- rnorm(n_time)
resid[1, v] <- e[1]
for (t in 2:n_time) {
resid[t, v] <- phi_true * resid[t-1, v] + e[t]
}
}
# Fit AR model
plan <- fit_noise(resid, method = "ar", p = 1)
# With multiple runs
runs <- rep(1:2, each = 100)
plan_runs <- fit_noise(resid, runs = runs, method = "ar", pooling = "run")
Run the code above in your browser using DataLab