1 | fflynx()
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function ()
{
Y <- log10(lynx)
FAR2 <- 1:114
FAR11 <- 1:114
FAR12 <- 1:114
SETAR272 <- 1:114
SETAR252 <- 1:114
for (i in 3:114) {
FAR2[i] <- 1.05 + 1.41 * Y[i - 1] - 0.77 * Y[i - 2]
}
for (i in 12:114) {
FAR11[i] <- 1.13 * Y[i - 1] - 0.51 * Y[i - 2] + 0.23 *
Y[i - 3] - 0.29 * Y[i - 4]
+0.14 * Y[i - 5] - 0.14 * Y[i - 6] + 0.08 * Y[i - 7] -
0.04 * Y[i - 8]
+0.13 * Y[i - 9] + 0.19 * Y[i - 10] - 0.31 * Y[i - 11]
}
for (i in 13:114) {
FAR12[i] <- 1.123 + 1.084 * Y[i - 1] - 0.477 * Y[i -
2] + 0.265 * Y[i - 3] - 0.218 * Y[i - 4]
+0.18 * Y[i - 9] - 0.224 * Y[i - 12]
}
for (i in 13:114) {
if (Y[i - 2] <= 3.116) {
SETAR272[i] <- 0.546 + 1.032 * Y[i - 1] - 0.173 *
Y[i - 2] + 0.171 * Y[i - 3] - 0.431 * Y[i - 4]
+0.332 * Y[i - 5] - 0.284 * Y[i - 6] + 0.21 * Y[i -
7]
}
else {
SETAR272[i] <- 2.632 + 1.492 * Y[i - 1] - 1.324 *
Y[i - 2]
}
}
for (i in 13:114) {
if (Y[i - 2] <= 3.05) {
SETAR252[i] <- 0.768 + 1.064 * Y[i - 1] - 0.2 * Y[i -
2] + 0.164 * Y[i - 3] - 0.428 * Y[i - 4]
+0.181 * Y[i - 5]
}
else {
SETAR252[i] <- 2.254 + 1.474 * Y[i - 1] - 1.202 *
Y[i - 2]
}
}
x <- cbind(Y, FAR2, FAR11, FAR12, SETAR272, SETAR252)
x <- x[13:114, ]
print(cor(x))
pairs(x)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.