Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
- Copyright (C) 2017 The R Foundation for Statistical Computing
- Platform: x86_64-pc-linux-gnu (64-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.
- > source('/home/pw/wessanet/cretab')
- >
- >
- >
- > myrfcuid = 'account3'
- >
- > x <- c(97.7,88.9,96.5,89.5,85.4,84.3,83.7,86.2,90.7,95.7,95.6,97,97.2,86.6,88.4,81.4,86.9,84.9,83.7,86.8,88.3,92.5,94.7,94.5,98.7,88.6,95.2,91.3,91.7,89.3,88.7,91.2,88.6,94.6,96,94.3,102,93.4,96.7,93.7,91.6,89.6,92.9,94.1,92,97.5,92.7,100.7,105.9,95.3,99.8,91.3,90.8,87.1,91.4,86.1,87.1,92.6,96.6,105.3,102.4,98.2,98.6,92.6,87.9,84.1,86.7,84.4,86,90.4,92.9,105.8,106,99.1,99.9,88.1,87.8,87.1,85.9,86.5,84.1,92.1,93.3,98.9,103,98.4,100.7,92.3,89,88.9,85.5,90.1,87,97.1,101.5,103,106.1,96.1,94.2,89.1,85.2,86.5,88,88.4,87.9,95.7,94.8,105.2,108.7,96.1,98.3,88.6,90.8,88.1,91.9,98.5,98.6,100.3,98.7,110.7,115.4,105.4,108,94.5,96.5,91,94.1,96.4,93.1,97.5,102.5,105.7,109.1,97.2,100.3,91.3,94.3,89.5,89.3,93.4,91.9,92.9,93.7,100.1,105.5,110.5,89.5,90.4,89.9,84.6,86.2,83.4,82.9,81.8,87.6,94.6,99.6,96.7,99.8,83.8,82.4,86.8,91,85.3,83.6,94,100.3,107.1,100.7,95.5,92.9,79.2,82,79.3,81.5,76,73.1,80.4,82.1,90.5,98.1,89.5,86.5,77,74.7,73.4,72.5,69.3,75.2,83.5,90.5,92.2,110.5,101.8,107.4,95.5,84.5,81.1,86.2,91.5,84.7,92.2,99.2,104.5,113,100.4,101,84.8,86.5,91.7,94.8,95)
- > par4 = '12'
- > par3 = 'additive'
- > par2 = 'Single'
- > par1 = '12'
- > par4 <- '12'
- > par3 <- 'additive'
- > par2 <- 'Single'
- > par1 <- '12'
- > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Sat, 15 Jul 2017 00:13:36 +0200)
- > #Author: root
- > #To cite this work: Wessa P., (2017), Exponential Smoothing (v1.0.7) in Free Statistics Software (v$_version), Office for Research Development and Education, URL https://www.wessa.net/rwasp_exponentialsmoothing.wasp/
- > #Source of accompanying publication:
- > #
- > par1 <- as.numeric(par1)
- > par4 <- as.numeric(par4)
- > if (par2 == 'Single') K <- 1
- > if (par2 == 'Double') K <- 2
- > if (par2 == 'Triple') K <- par1
- > nx <- length(x)
- > nxmK <- nx - K
- > x <- ts(x, frequency = par1)
- > if (par2 == 'Single') fit <- HoltWinters(x, gamma=F, beta=F)
- > if (par2 == 'Double') fit <- HoltWinters(x, gamma=F)
- > if (par2 == 'Triple') fit <- HoltWinters(x, seasonal=par3)
- > fit
- Holt-Winters exponential smoothing without trend and without seasonal component.
- Call:
- HoltWinters(x = x, beta = F, gamma = F)
- Smoothing parameters:
- alpha: 0.9252093
- beta : FALSE
- gamma: FALSE
- Coefficients:
- [,1]
- a 94.96551
- > myresid <- x - fit$fitted[,'xhat']
- > postscript(file="/home/pw/wessanet/rcomp/tmp/1f6eo1516787198.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
- > op <- par(mfrow=c(2,1))
- > plot(fit,ylab='Observed (black) / Fitted (red)',main='Interpolation Fit of Exponential Smoothing')
- > plot(myresid,ylab='Residuals',main='Interpolation Prediction Errors')
- > par(op)
- > dev.off()
- null device
- 1
- > postscript(file="/home/pw/wessanet/rcomp/tmp/2p8c81516787198.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
- > p <- predict(fit, par4, prediction.interval=TRUE)
- > np <- length(p[,1])
- > plot(fit,p,ylab='Observed (black) / Fitted (red)',main='Extrapolation Fit of Exponential Smoothing')
- > dev.off()
- null device
- 1
- > postscript(file="/home/pw/wessanet/rcomp/tmp/37ic31516787198.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
- > op <- par(mfrow = c(2,2))
- > acf(as.numeric(myresid),lag.max = nx/2,main='Residual ACF')
- > spectrum(myresid,main='Residals Periodogram')
- > cpgram(myresid,main='Residal Cumulative Periodogram')
- > qqnorm(myresid,main='Residual Normal QQ Plot')
- > qqline(myresid)
- > par(op)
- > dev.off()
- null device
- 1
- >
- > a<-table.start()
- > a<-table.row.start(a)
- > a<-table.element(a,'Estimated Parameters of Exponential Smoothing',2,TRUE)
- > a<-table.row.end(a)
- > a<-table.row.start(a)
- > a<-table.element(a,'Parameter',header=TRUE)
- > a<-table.element(a,'Value',header=TRUE)
- > a<-table.row.end(a)
- > a<-table.row.start(a)
- > a<-table.element(a,'alpha',header=TRUE)
- > a<-table.element(a,fit$alpha)
- > a<-table.row.end(a)
- > a<-table.row.start(a)
- > a<-table.element(a,'beta',header=TRUE)
- > a<-table.element(a,fit$beta)
- > a<-table.row.end(a)
- > a<-table.row.start(a)
- > a<-table.element(a,'gamma',header=TRUE)
- > a<-table.element(a,fit$gamma)
- > a<-table.row.end(a)
- > a<-table.end(a)
- > table.save(a,file="/home/pw/wessanet/rcomp/tmp/44s2k1516787198.tab")
- > a<-table.start()
- > a<-table.row.start(a)
- > a<-table.element(a,'Interpolation Forecasts of Exponential Smoothing',4,TRUE)
- > a<-table.row.end(a)
- > a<-table.row.start(a)
- > a<-table.element(a,'t',header=TRUE)
- > a<-table.element(a,'Observed',header=TRUE)
- > a<-table.element(a,'Fitted',header=TRUE)
- > a<-table.element(a,'Residuals',header=TRUE)
- > a<-table.row.end(a)
- > for (i in 1:nxmK) {
- + a<-table.row.start(a)
- + a<-table.element(a,i+K,header=TRUE)
- + a<-table.element(a,x[i+K])
- + a<-table.element(a,fit$fitted[i,'xhat'])
- + a<-table.element(a,myresid[i])
- + a<-table.row.end(a)
- + }
- > a<-table.end(a)
- > table.save(a,file="/home/pw/wessanet/rcomp/tmp/52xp41516787198.tab")
- > a<-table.start()
- > a<-table.row.start(a)
- > a<-table.element(a,'Extrapolation Forecasts of Exponential Smoothing',4,TRUE)
- > a<-table.row.end(a)
- > a<-table.row.start(a)
- > a<-table.element(a,'t',header=TRUE)
- > a<-table.element(a,'Forecast',header=TRUE)
- > a<-table.element(a,'95% Lower Bound',header=TRUE)
- > a<-table.element(a,'95% Upper Bound',header=TRUE)
- > a<-table.row.end(a)
- > for (i in 1:np) {
- + a<-table.row.start(a)
- + a<-table.element(a,nx+i,header=TRUE)
- + a<-table.element(a,p[i,'fit'])
- + a<-table.element(a,p[i,'lwr'])
- + a<-table.element(a,p[i,'upr'])
- + a<-table.row.end(a)
- + }
- > a<-table.end(a)
- > table.save(a,file="/home/pw/wessanet/rcomp/tmp/62ieq1516787198.tab")
- >
- > try(system("convert /home/pw/wessanet/rcomp/tmp/1f6eo1516787198.ps /home/pw/wessanet/rcomp/tmp/1f6eo1516787198.png",intern=TRUE))
- character(0)
- > try(system("convert /home/pw/wessanet/rcomp/tmp/2p8c81516787198.ps /home/pw/wessanet/rcomp/tmp/2p8c81516787198.png",intern=TRUE))
- character(0)
- > try(system("convert /home/pw/wessanet/rcomp/tmp/37ic31516787198.ps /home/pw/wessanet/rcomp/tmp/37ic31516787198.png",intern=TRUE))
- character(0)
- >
- > proc.time()
- user system elapsed
- 3.744 0.524 4.783
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement