It depends on what's actually being done. If there really is a function like `estimate_GARCH_parameters_by_four_methods(...)`

, then `lapply()`

is a great solution.

But if there isn't, then `lapply()`

often won't simplify code. For example:

```
results <- vector("list", 6000)
for (ii in seq_along(results)) {
# A whole bunch of prep logic
m1 <- estimate_GARCH_parameters_m1(...)
m2 <- estimate_GARCH_parameters_m2(...)
m3 <- estimate_GARCH_parameters_m3(...)
m4 <- estimate_GARCH_parameters_m4(...)
results[[ii]] <- list(m1, m2, m3, m4)
}
```

Writing a wrapper function and feeding it to `lapply()`

won't clarify this code.

```
estimate <- function(ii) {
# A whole bunch of prep logic
m1 <- estimate_GARCH_parameters_m1(...)
m2 <- estimate_GARCH_parameters_m2(...)
m3 <- estimate_GARCH_parameters_m3(...)
m4 <- estimate_GARCH_parameters_m4(...)
list(m1, m2, m3, m4)
}
results <- lapply(1:6000, estimate)
```

The `for`

block is obviously just an iterative loop, where the `1:6000`

vector might be irrelevant. The `lapply()`

code makes the `1:6000`

vector seem important.