Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.78 KB | None | 0 0
  1.  
  2. R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
  3. Copyright (C) 2017 The R Foundation for Statistical Computing
  4. Platform: x86_64-pc-linux-gnu (64-bit)
  5.  
  6. R is free software and comes with ABSOLUTELY NO WARRANTY.
  7. You are welcome to redistribute it under certain conditions.
  8. Type 'license()' or 'licence()' for distribution details.
  9.  
  10. R is a collaborative project with many contributors.
  11. Type 'contributors()' for more information and
  12. 'citation()' on how to cite R or R packages in publications.
  13.  
  14. Type 'demo()' for some demos, 'help()' for on-line help, or
  15. 'help.start()' for an HTML browser interface to help.
  16. Type 'q()' to quit R.
  17.  
  18. > source('/home/pw/wessanet/cretab')
  19. >
  20. >
  21. >
  22. > myrfcuid = 'account3'
  23. >
  24. > 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)
  25. > par4 = '12'
  26. > par3 = 'additive'
  27. > par2 = 'Single'
  28. > par1 = '12'
  29. > par4 <- '12'
  30. > par3 <- 'additive'
  31. > par2 <- 'Single'
  32. > par1 <- '12'
  33. > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Sat, 15 Jul 2017 00:13:36 +0200)
  34. > #Author: root
  35. > #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/
  36. > #Source of accompanying publication:
  37. > #
  38. > par1 <- as.numeric(par1)
  39. > par4 <- as.numeric(par4)
  40. > if (par2 == 'Single') K <- 1
  41. > if (par2 == 'Double') K <- 2
  42. > if (par2 == 'Triple') K <- par1
  43. > nx <- length(x)
  44. > nxmK <- nx - K
  45. > x <- ts(x, frequency = par1)
  46. > if (par2 == 'Single') fit <- HoltWinters(x, gamma=F, beta=F)
  47. > if (par2 == 'Double') fit <- HoltWinters(x, gamma=F)
  48. > if (par2 == 'Triple') fit <- HoltWinters(x, seasonal=par3)
  49. > fit
  50. Holt-Winters exponential smoothing without trend and without seasonal component.
  51.  
  52. Call:
  53. HoltWinters(x = x, beta = F, gamma = F)
  54.  
  55. Smoothing parameters:
  56. alpha: 0.9252093
  57. beta : FALSE
  58. gamma: FALSE
  59.  
  60. Coefficients:
  61. [,1]
  62. a 94.96551
  63. > myresid <- x - fit$fitted[,'xhat']
  64. > postscript(file="/home/pw/wessanet/rcomp/tmp/1f6eo1516787198.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
  65. > op <- par(mfrow=c(2,1))
  66. > plot(fit,ylab='Observed (black) / Fitted (red)',main='Interpolation Fit of Exponential Smoothing')
  67. > plot(myresid,ylab='Residuals',main='Interpolation Prediction Errors')
  68. > par(op)
  69. > dev.off()
  70. null device
  71. 1
  72. > postscript(file="/home/pw/wessanet/rcomp/tmp/2p8c81516787198.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
  73. > p <- predict(fit, par4, prediction.interval=TRUE)
  74. > np <- length(p[,1])
  75. > plot(fit,p,ylab='Observed (black) / Fitted (red)',main='Extrapolation Fit of Exponential Smoothing')
  76. > dev.off()
  77. null device
  78. 1
  79. > postscript(file="/home/pw/wessanet/rcomp/tmp/37ic31516787198.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
  80. > op <- par(mfrow = c(2,2))
  81. > acf(as.numeric(myresid),lag.max = nx/2,main='Residual ACF')
  82. > spectrum(myresid,main='Residals Periodogram')
  83. > cpgram(myresid,main='Residal Cumulative Periodogram')
  84. > qqnorm(myresid,main='Residual Normal QQ Plot')
  85. > qqline(myresid)
  86. > par(op)
  87. > dev.off()
  88. null device
  89. 1
  90. >
  91. > a<-table.start()
  92. > a<-table.row.start(a)
  93. > a<-table.element(a,'Estimated Parameters of Exponential Smoothing',2,TRUE)
  94. > a<-table.row.end(a)
  95. > a<-table.row.start(a)
  96. > a<-table.element(a,'Parameter',header=TRUE)
  97. > a<-table.element(a,'Value',header=TRUE)
  98. > a<-table.row.end(a)
  99. > a<-table.row.start(a)
  100. > a<-table.element(a,'alpha',header=TRUE)
  101. > a<-table.element(a,fit$alpha)
  102. > a<-table.row.end(a)
  103. > a<-table.row.start(a)
  104. > a<-table.element(a,'beta',header=TRUE)
  105. > a<-table.element(a,fit$beta)
  106. > a<-table.row.end(a)
  107. > a<-table.row.start(a)
  108. > a<-table.element(a,'gamma',header=TRUE)
  109. > a<-table.element(a,fit$gamma)
  110. > a<-table.row.end(a)
  111. > a<-table.end(a)
  112. > table.save(a,file="/home/pw/wessanet/rcomp/tmp/44s2k1516787198.tab")
  113. > a<-table.start()
  114. > a<-table.row.start(a)
  115. > a<-table.element(a,'Interpolation Forecasts of Exponential Smoothing',4,TRUE)
  116. > a<-table.row.end(a)
  117. > a<-table.row.start(a)
  118. > a<-table.element(a,'t',header=TRUE)
  119. > a<-table.element(a,'Observed',header=TRUE)
  120. > a<-table.element(a,'Fitted',header=TRUE)
  121. > a<-table.element(a,'Residuals',header=TRUE)
  122. > a<-table.row.end(a)
  123. > for (i in 1:nxmK) {
  124. + a<-table.row.start(a)
  125. + a<-table.element(a,i+K,header=TRUE)
  126. + a<-table.element(a,x[i+K])
  127. + a<-table.element(a,fit$fitted[i,'xhat'])
  128. + a<-table.element(a,myresid[i])
  129. + a<-table.row.end(a)
  130. + }
  131. > a<-table.end(a)
  132. > table.save(a,file="/home/pw/wessanet/rcomp/tmp/52xp41516787198.tab")
  133. > a<-table.start()
  134. > a<-table.row.start(a)
  135. > a<-table.element(a,'Extrapolation Forecasts of Exponential Smoothing',4,TRUE)
  136. > a<-table.row.end(a)
  137. > a<-table.row.start(a)
  138. > a<-table.element(a,'t',header=TRUE)
  139. > a<-table.element(a,'Forecast',header=TRUE)
  140. > a<-table.element(a,'95% Lower Bound',header=TRUE)
  141. > a<-table.element(a,'95% Upper Bound',header=TRUE)
  142. > a<-table.row.end(a)
  143. > for (i in 1:np) {
  144. + a<-table.row.start(a)
  145. + a<-table.element(a,nx+i,header=TRUE)
  146. + a<-table.element(a,p[i,'fit'])
  147. + a<-table.element(a,p[i,'lwr'])
  148. + a<-table.element(a,p[i,'upr'])
  149. + a<-table.row.end(a)
  150. + }
  151. > a<-table.end(a)
  152. > table.save(a,file="/home/pw/wessanet/rcomp/tmp/62ieq1516787198.tab")
  153. >
  154. > try(system("convert /home/pw/wessanet/rcomp/tmp/1f6eo1516787198.ps /home/pw/wessanet/rcomp/tmp/1f6eo1516787198.png",intern=TRUE))
  155. character(0)
  156. > try(system("convert /home/pw/wessanet/rcomp/tmp/2p8c81516787198.ps /home/pw/wessanet/rcomp/tmp/2p8c81516787198.png",intern=TRUE))
  157. character(0)
  158. > try(system("convert /home/pw/wessanet/rcomp/tmp/37ic31516787198.ps /home/pw/wessanet/rcomp/tmp/37ic31516787198.png",intern=TRUE))
  159. character(0)
  160. >
  161. > proc.time()
  162. user system elapsed
  163. 3.744 0.524 4.783
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement