R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(0.8564,0.8973,0.9383,0.9217,0.9095,0.892,0.8742,0.8532,0.8607,0.9005,0.9111,0.9059,0.8883,0.8924,0.8833,0.87,0.8758,0.8858,0.917,0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718,1.4748,1.5527,1.575,1.5557,1.5553,1.577,1.4975,1.437,1.3322,1.2732,1.3449,1.3239,1.2785,1.305,1.319,1.365,1.4016,1.4088,1.4268,1.4562,1.4816,1.4914,1.4614,1.4272,1.3686,1.3569,1.3406,1.2565,1.2208,1.277,1.2894,1.3067,1.3898,1.3661,1.322,1.336,1.3649,1.3999,1.4442,1.4349,1.4388,1.4264,1.4343,1.377,1.3706) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > par1 <- as.numeric(par1) > nx <- length(x) > x <- ts(x,frequency=par1) > m <- StructTS(x,type='BSM') > m$coef level slope seas epsilon 0.001033568 0.000000000 0.000000000 0.000000000 > m$fitted level slope sea Jan 1 0.8564000 0.0000000000 0.0000000000 Feb 1 0.8951732 0.0021268000 0.0021268000 Mar 1 0.9360183 0.0022816733 0.0022816733 Apr 1 0.9194933 0.0022067460 0.0022067460 May 1 0.9073502 0.0021498023 0.0021498023 Jun 1 0.8899276 0.0020724409 0.0020724409 Jul 1 0.8722055 0.0019945098 0.0019945098 Aug 1 0.8512953 0.0019046875 0.0019046875 Sep 1 0.8587735 0.0019264591 0.0019264591 Oct 1 0.8984267 0.0020732558 0.0020732558 Nov 1 0.9089938 0.0021061776 0.0021061776 Dec 1 0.9038219 0.0020780769 0.0020780769 Jan 2 0.9094887 0.0019262467 -0.0211887137 Feb 2 0.8909687 0.0014312727 0.0014312726 Mar 2 0.8818878 0.0014121597 0.0014121597 Apr 2 0.8686145 0.0013855072 0.0013855072 May 2 0.8744065 0.0013934901 0.0013934901 Jun 2 0.8843910 0.0014090253 0.0014090253 Jul 2 0.9155373 0.0014627027 0.0014627027 Aug 2 0.9538709 0.0015291367 0.0015291367 Sep 2 0.9906075 0.0015924596 0.0015924596 Oct 2 0.9762362 0.0015637993 0.0015637993 Nov 2 0.9792336 0.0015663685 0.0015663685 Dec 2 0.9795359 0.0015641071 0.0015641071 Jan 3 1.0119413 0.0009582966 -0.0105412628 Feb 3 1.0172738 0.0010262353 0.0010262352 Mar 3 1.0611234 0.0010766158 0.0010766158 Apr 3 1.0762069 0.0010930751 0.0010930751 May 3 1.0796042 0.0010957796 0.0010957796 Jun 3 1.0837007 0.0010992974 0.0010992974 Jul 3 1.1570161 0.0011838597 0.0011838597 Aug 3 1.1651081 0.0011919393 0.0011919393 Sep 3 1.1360434 0.0011565928 0.0011565928 Oct 3 1.1127719 0.0011280886 0.0011280886 Nov 3 1.1210636 0.0011364377 0.0011364377 Dec 3 1.1680102 0.0011897675 0.0011897675 Jan 4 1.1815498 0.0010318043 -0.0113498470 Feb 4 1.2270597 0.0015403478 0.0015403477 Mar 4 1.2597326 0.0015674196 0.0015674196 Apr 4 1.2630311 0.0015689236 0.0015689236 May 4 1.2246657 0.0015342585 0.0015342585 Jun 4 1.1969911 0.0015089255 0.0015089255 Jul 4 1.1991905 0.0015095238 0.0015095238 Aug 4 1.2122804 0.0015195502 0.0015195502 Sep 4 1.2250707 0.0015292999 0.0015292999 Oct 4 1.2160798 0.0015202073 0.0015202073 Nov 4 1.2202775 0.0015225194 0.0015225194 Dec 4 1.2474553 0.0015446552 0.0015446552 Jan 5 1.3097539 0.0009685402 -0.0106539422 Feb 5 1.3395705 0.0012295173 0.0012295171 Mar 5 1.3106912 0.0012087526 0.0012087526 Apr 5 1.3001993 0.0012006887 0.0012006887 May 5 1.3188873 0.0012127323 0.0012127323 Jun 5 1.2926062 0.0011938102 0.0011938102 Jul 5 1.2682238 0.0011762199 0.0011762199 Aug 5 1.2153609 0.0011390797 0.0011390797 Sep 5 1.2025705 0.0011295127 0.0011295127 Oct 5 1.2280538 0.0011462277 0.0011462277 Nov 5 1.2244570 0.0011429746 0.0011429746 Dec 5 1.2003743 0.0011256849 0.0011256849 Jan 6 1.1917875 0.0011988615 -0.0131874763 Feb 6 1.1844649 0.0011350857 0.0011350856 Mar 6 1.2091515 0.0011485437 0.0011485437 Apr 6 1.1926615 0.0011384703 0.0011384703 May 6 1.2008575 0.0011424986 0.0011424986 Jun 6 1.2259438 0.0011561574 0.0011561574 Jul 6 1.2758161 0.0011839316 0.0011839316 Aug 6 1.2638236 0.0011764237 0.0011764237 Sep 6 1.2672223 0.0011776893 0.0011776893 Oct 6 1.2799158 0.0011842435 0.0011842435 Nov 6 1.2715212 0.0011787948 0.0011787948 Dec 6 1.2599285 0.0011715341 0.0011715341 Jan 7 1.2984211 0.0009382775 -0.0103210526 Feb 7 1.3202285 0.0010714634 0.0010714633 Mar 7 1.2988395 0.0010605071 0.0010605071 Apr 7 1.3063364 0.0010636452 0.0010636452 May 7 1.3231287 0.0010713103 0.0010713103 Jun 7 1.3505159 0.0010841285 0.0010841285 Jul 7 1.3500166 0.0010833577 0.0010833577 Aug 7 1.3408216 0.0010783560 0.0010783560 Sep 7 1.3705077 0.0010922703 0.0010922703 Oct 7 1.3611128 0.0010871720 0.0010871720 Nov 7 1.3885000 0.0010999514 0.0010999514 Dec 7 1.4215845 0.0011154854 0.0011154854 Jan 8 1.4774542 0.0008231087 -0.0090541953 Feb 8 1.4562991 0.0007008511 0.0007008509 Mar 8 1.4710932 0.0007068482 0.0007068482 Apr 8 1.4740922 0.0007078231 0.0007078231 May 8 1.5519594 0.0007406290 0.0007406290 Jun 8 1.5742502 0.0007497876 0.0007497876 Jul 8 1.5549587 0.0007412739 0.0007412739 Aug 8 1.5545592 0.0007407895 0.0007407895 Sep 8 1.5762503 0.0007496818 0.0007496818 Oct 8 1.4967844 0.0007156489 0.0007156489 Nov 8 1.4363103 0.0006896990 0.0006896990 Dec 8 1.3315550 0.0006450000 0.0006450000 Jan 9 1.2828264 0.0008751310 -0.0096264410 Feb 9 1.3437289 0.0011710566 0.0011710565 Mar 9 1.3227373 0.0011626933 0.0011626933 Apr 9 1.2773549 0.0011451357 0.0011451357 May 9 1.3038453 0.0011546928 0.0011546928 Jun 9 1.3178405 0.0011595328 0.0011595328 Jul 9 1.3638236 0.0011764218 0.0011764218 Aug 9 1.4004102 0.0011897590 0.0011897590 Sep 9 1.4076080 0.0011920211 0.0011920211 Oct 9 1.4256017 0.0011983446 0.0011983446 Nov 9 1.4549910 0.0012089507 0.0012089507 Dec 9 1.4803820 0.0012180451 0.0012180451 Jan 10 1.5037891 0.0011262855 -0.0123891406 Feb 10 1.4604704 0.0009295593 0.0009295592 Mar 10 1.4262823 0.0009176550 0.0009176550 Apr 10 1.3677025 0.0008974932 0.0008974932 May 10 1.3560068 0.0008932272 0.0008932272 Jun 10 1.3397126 0.0008874069 0.0008874069 Jul 10 1.2556414 0.0008586464 0.0008586464 Aug 10 1.2199537 0.0008462788 0.0008462788 Sep 10 1.2761350 0.0008649983 0.0008649983 Oct 10 1.2885311 0.0008688979 0.0008688979 Nov 10 1.3058255 0.0008744508 0.0008744508 Dec 10 1.3888978 0.0009022297 0.0009022297 Jan 11 1.3765655 0.0009514119 -0.0104655307 Feb 11 1.3212745 0.0007255385 0.0007255384 Mar 11 1.3352704 0.0007296217 0.0007296217 Apr 11 1.3641617 0.0007382841 0.0007382841 May 11 1.3991512 0.0007488165 0.0007488165 Jun 11 1.4434378 0.0007622004 0.0007622004 Jul 11 1.4341409 0.0007591091 0.0007591091 Aug 11 1.4380399 0.0007600737 0.0007600737 Sep 11 1.4256440 0.0007560332 0.0007560332 Oct 11 1.4335418 0.0007582259 0.0007582259 Nov 11 1.3762596 0.0007404112 0.0007404112 Dec 11 1.3698618 0.0007382209 0.0007382209 > m$resid Jan Feb Mar Apr May Jun 1 0.00000000 0.72414636 1.20674072 -0.58614842 -0.44723568 -0.61000321 2 0.13512794 -0.54214241 -0.32727810 -0.45720737 0.13718869 0.26746397 3 1.05789417 0.12367652 1.33280567 0.43594163 0.07171488 0.09339162 4 0.41027720 1.29240536 0.96880058 0.05386856 -1.24269505 -0.90893821 5 1.98586886 0.85103623 -0.93685634 -0.36407559 0.54412915 -0.85548984 6 -0.31437799 -0.25382115 0.73277787 -0.54880168 0.21958639 0.74498618 7 1.20011394 0.62577292 -0.69880498 0.20025177 0.48936046 0.81875513 8 1.75243595 -0.66225434 0.43846107 0.07131338 2.40055419 0.67046228 9 -1.57464387 1.81554094 -0.68950115 -1.44806057 0.78851499 0.39947830 10 0.70571718 -1.34822028 -1.09252061 -1.85098446 -0.39177897 -0.53470521 11 -0.41998817 -1.71017216 0.41283892 0.87610554 1.06554765 1.35445241 Jul Aug Sep Oct Nov Dec 1 -0.61691952 -0.71384643 0.17370339 1.17577210 0.26471207 -0.22682137 2 0.92581377 1.14790181 1.09611575 -0.49699989 0.04463308 -0.03935524 3 2.24759950 0.21500101 -0.94168159 -0.76027945 0.22295258 1.42575752 4 0.02148658 0.36036606 0.35072699 -0.32737268 0.08331905 0.79835429 5 -0.79582244 -1.68146436 -0.43342658 0.75778457 -0.14758092 -0.78491437 6 1.51574634 -0.40996972 0.06914471 0.35829980 -0.29803336 -0.39737177 7 -0.04926236 -0.31978628 0.89006048 -0.32628301 0.81826235 0.99512063 8 -0.62351669 -0.03549182 0.65179842 -2.49563887 -1.90371056 -3.28056429 9 1.39450109 1.10164378 0.18691350 0.52271422 0.87704818 0.75232170 10 -2.64308794 -1.13696518 1.72148763 0.35873584 0.51100344 2.55719556 11 -0.31293690 0.09768248 -0.40928155 0.22217915 -1.80562539 -0.22206859 > mylevel <- as.numeric(m$fitted[,'level']) > myslope <- as.numeric(m$fitted[,'slope']) > myseas <- as.numeric(m$fitted[,'sea']) > myresid <- as.numeric(m$resid) > myfit <- mylevel+myseas > mylagmax <- nx/2 > postscript(file="/var/www/rcomp/tmp/14vob1324311528.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > acf(as.numeric(x),lag.max = mylagmax,main='Observed') > acf(mylevel,na.action=na.pass,lag.max = mylagmax,main='Level') > acf(myseas,na.action=na.pass,lag.max = mylagmax,main='Seasonal') > acf(myresid,na.action=na.pass,lag.max = mylagmax,main='Standardized Residals') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/254ls1324311528.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > spectrum(as.numeric(x),main='Observed') > spectrum(mylevel,main='Level') > spectrum(myseas,main='Seasonal') > spectrum(myresid,main='Standardized Residals') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3dn1c1324311528.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > cpgram(as.numeric(x),main='Observed') > cpgram(mylevel,main='Level') > cpgram(myseas,main='Seasonal') > cpgram(myresid,main='Standardized Residals') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/4qp8v1324311528.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(as.numeric(m$resid),main='Standardized Residuals',ylab='Residuals',xlab='time',type='b') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5jvhu1324311528.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > hist(m$resid,main='Residual Histogram') > plot(density(m$resid),main='Residual Kernel Density') > qqnorm(m$resid,main='Residual Normal QQ Plot') > qqline(m$resid) > plot(m$resid^2, myfit^2,main='Sq.Resid vs. Sq.Fit',xlab='Squared residuals',ylab='Squared Fit') > par(op) > dev.off() null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Structural Time Series Model',6,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,'Level',header=TRUE) > a<-table.element(a,'Slope',header=TRUE) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,'Stand. Residuals',header=TRUE) > a<-table.row.end(a) > for (i in 1:nx) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,mylevel[i]) + a<-table.element(a,myslope[i]) + a<-table.element(a,myseas[i]) + a<-table.element(a,myresid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/6o3ds1324311528.tab") > > try(system("convert tmp/14vob1324311528.ps tmp/14vob1324311528.png",intern=TRUE)) character(0) > try(system("convert tmp/254ls1324311528.ps tmp/254ls1324311528.png",intern=TRUE)) character(0) > try(system("convert tmp/3dn1c1324311528.ps tmp/3dn1c1324311528.png",intern=TRUE)) character(0) > try(system("convert tmp/4qp8v1324311528.ps tmp/4qp8v1324311528.png",intern=TRUE)) character(0) > try(system("convert tmp/5jvhu1324311528.ps tmp/5jvhu1324311528.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.270 0.110 2.348