R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(46,62,66,59,58,61,41,27,58,70,49,59,44,36,72,45,56,54,53,35,61,52,47,51,52,63,74,45,51,64,36,30,55,64,39,40,63,45,59,55,40,64,27,28,45,57,45,69,60,56,58,50,51,53,37,22,55,70,62,58,39,49,58,47,42,62,39,40,72,70,54,65) > par10 = 'FALSE' > par9 = '0' > par8 = '0' > par7 = '0' > par6 = '0' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1.4' > par1 = '12' > par10 <- 'FALSE' > par9 <- '0' > par8 <- '0' > par7 <- '0' > par6 <- '0' > par5 <- '12' > par4 <- '0' > par3 <- '0' > par2 <- '1.4' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), ARIMA Forecasting (v1.0.9) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_arimaforecasting.wasp/ > #Source of accompanying publication: > # > par1 <- as.numeric(par1) #cut off periods > par2 <- as.numeric(par2) #lambda > par3 <- as.numeric(par3) #degree of non-seasonal differencing > par4 <- as.numeric(par4) #degree of seasonal differencing > par5 <- as.numeric(par5) #seasonal period > par6 <- as.numeric(par6) #p > par7 <- as.numeric(par7) #q > par8 <- as.numeric(par8) #P > par9 <- as.numeric(par9) #Q > if (par10 == 'TRUE') par10 <- TRUE > if (par10 == 'FALSE') par10 <- FALSE > if (par2 == 0) x <- log(x) > if (par2 != 0) x <- x^par2 > lx <- length(x) > first <- lx - 2*par1 > nx <- lx - par1 > nx1 <- nx + 1 > fx <- lx - nx > if (fx < 1) { + fx <- par5 + nx1 <- lx + fx - 1 + first <- lx - 2*fx + } > first <- 1 > if (fx < 3) fx <- round(lx/10,0) > (arima.out <- arima(x[1:nx], order=c(par6,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5), include.mean=par10, method='ML')) Call: arima(x = x[1:nx], order = c(par6, par3, par7), seasonal = list(order = c(par8, par4, par9), period = par5), include.mean = par10, method = "ML") sigma^2 estimated as 71195: log likelihood = -420.33, aic = 842.66 > (forecast <- predict(arima.out,par1)) $pred Time Series: Start = 61 End = 72 Frequency = 1 [1] 0 0 0 0 0 0 0 0 0 0 0 0 $se Time Series: Start = 61 End = 72 Frequency = 1 [1] 266.824 266.824 266.824 266.824 266.824 266.824 266.824 266.824 266.824 [10] 266.824 266.824 266.824 > (lb <- forecast$pred - 1.96 * forecast$se) Time Series: Start = 61 End = 72 Frequency = 1 [1] -522.975 -522.975 -522.975 -522.975 -522.975 -522.975 -522.975 -522.975 [9] -522.975 -522.975 -522.975 -522.975 > (ub <- forecast$pred + 1.96 * forecast$se) Time Series: Start = 61 End = 72 Frequency = 1 [1] 522.975 522.975 522.975 522.975 522.975 522.975 522.975 522.975 522.975 [10] 522.975 522.975 522.975 > if (par2 == 0) { + x <- exp(x) + forecast$pred <- exp(forecast$pred) + lb <- exp(lb) + ub <- exp(ub) + } > if (par2 != 0) { + x <- x^(1/par2) + forecast$pred <- forecast$pred^(1/par2) + lb <- lb^(1/par2) + ub <- ub^(1/par2) + } > if (par2 < 0) { + olb <- lb + lb <- ub + ub <- olb + } > (actandfor <- c(x[1:nx], forecast$pred)) [1] 46 62 66 59 58 61 41 27 58 70 49 59 44 36 72 45 56 54 53 35 61 52 47 51 52 [26] 63 74 45 51 64 36 30 55 64 39 40 63 45 59 55 40 64 27 28 45 57 45 69 60 56 [51] 58 50 51 53 37 22 55 70 62 58 0 0 0 0 0 0 0 0 0 0 0 0 > (perc.se <- (ub-forecast$pred)/1.96/forecast$pred) Time Series: Start = 61 End = 72 Frequency = 1 [1] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf > postscript(file="/var/fisher/rcomp/tmp/1y5a61386160088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mar=c(4,4,2,2),las=1) > ylim <- c( min(x[first:nx],lb), max(x[first:nx],ub)) > plot(x,ylim=ylim,type='n',xlim=c(first,lx)) Error in plot.window(...) : need finite 'ylim' values Calls: plot -> plot.default -> localWindow -> plot.window Execution halted