Skip to content

Commit 3d08a22

Browse files
authored
Merge pull request #1185 from m-muecke/perf/sdtest-cumsum
perf(SD.test): replace cumulative-sum loops with apply/cumsum
2 parents 0316a04 + 6b9f824 commit 3d08a22

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

R/arima.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,7 @@ SD.test <- function(wts, s = frequency(wts)) {
226226
for (i in seq_len(s - 1)) {
227227
Fhataux[, i] <- R1[, i] * residuals(lmch)
228228
}
229-
for (i in seq_len(N)) {
230-
for (n in seq_len(s - 1)) {
231-
Fhat[i, n] <- sum(Fhataux[1:i, n])
232-
}
233-
}
229+
Fhat[] <- apply(Fhataux, 2, cumsum)
234230
wnw <- 1 - seq_len(ltrunc) / (ltrunc + 1)
235231
Ne <- nrow(Fhataux)
236232
Omnw <- 0

0 commit comments

Comments
 (0)