File: whichmodels.R

package info (click to toggle)
r-cran-forecast 8.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,248 kB
  • sloc: cpp: 975; ansic: 648; sh: 13; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
WhichModels <- function(max.p, max.q, max.P, max.Q, maxK) {
  total.models <- (max.p + 1) * (max.q + 1) * (max.P + 1) * (max.Q + 1) * length(0:maxK)
  x <- numeric(total.models)
  i <- 1

  for (x1 in 0:max.p) for (x2 in 0:max.q) {
      for (x3 in 0:max.P) for (x4 in 0:max.Q) {
          for (K in 0:maxK)
          {
            x[i] <- paste(x1, "f", x2, "f", x3, "f", x4, "f", K, sep = "")
            i <- i + 1
          }
        }
    }
  return(x)
}


UndoWhichModels <- function(n) {
  as.numeric(unlist(strsplit(n, split = "f")))
}