R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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.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.4369,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) > 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.00105124 0.00000000 0.00000000 0.00000000 > m$fitted level slope sea Jan 1 0.8973000 0.000000e+00 0.000000e+00 Feb 1 0.9361680 2.132000e-03 2.132000e-03 Mar 1 0.9196426 2.057371e-03 2.057371e-03 Apr 1 0.9074992 2.000794e-03 2.000794e-03 May 1 0.8900763 1.923715e-03 1.923715e-03 Jun 1 0.8723539 1.846063e-03 1.846063e-03 Jul 1 0.8514435 1.756471e-03 1.756471e-03 Aug 1 0.8589211 1.778906e-03 1.778906e-03 Sep 1 0.8985732 1.926848e-03 1.926848e-03 Oct 1 0.9091395 1.960465e-03 1.960465e-03 Nov 1 0.9039672 1.932819e-03 1.932819e-03 Dec 1 0.8864423 1.857692e-03 1.857692e-03 Jan 2 0.9050428 1.149344e-03 -1.264278e-02 Feb 2 0.8827189 5.810909e-04 5.810908e-04 Mar 2 0.8694441 5.558984e-04 5.558984e-04 Apr 2 0.8752346 5.653986e-04 5.653986e-04 May 2 0.8852175 5.824593e-04 5.824593e-04 Jun 2 0.9163623 6.377256e-04 6.377256e-04 Jul 2 0.9546942 7.057658e-04 7.057658e-04 Aug 2 0.9914293 7.706835e-04 7.706835e-04 Sep 2 0.9770566 7.434470e-04 7.434470e-04 Oct 2 0.9800525 7.474911e-04 7.474911e-04 Nov 2 0.9803533 7.466905e-04 7.466905e-04 Dec 2 1.0006184 7.816072e-04 7.816072e-04 Jan 3 1.0223673 3.697504e-04 -4.067254e-03 Feb 3 1.0612324 9.676471e-04 9.676467e-04 Mar 3 1.0763157 9.842538e-04 9.842538e-04 Apr 3 1.0797129 9.870892e-04 9.870892e-04 May 3 1.0838093 9.907386e-04 9.907386e-04 Jun 3 1.1571245 1.075527e-03 1.075527e-03 Jul 3 1.1652163 1.083743e-03 1.083743e-03 Aug 3 1.1361515 1.048481e-03 1.048481e-03 Sep 3 1.1128799 1.020070e-03 1.020070e-03 Oct 3 1.1211714 1.028555e-03 1.028555e-03 Nov 3 1.1681179 1.082072e-03 1.082072e-03 Dec 3 1.1691180 1.081977e-03 1.081977e-03 Jan 4 1.2318305 2.936799e-04 -3.230479e-03 Feb 4 1.2606798 6.201740e-04 6.201736e-04 Mar 4 1.2639775 6.225022e-04 6.225022e-04 Apr 4 1.2256114 5.886285e-04 5.886285e-04 May 4 1.1979359 5.640937e-04 5.640937e-04 Jun 4 1.2001345 5.655113e-04 5.655113e-04 Jul 4 1.2132236 5.763637e-04 5.763637e-04 Aug 4 1.2260131 5.869378e-04 5.869378e-04 Sep 4 1.2170213 5.786517e-04 5.786517e-04 Oct 4 1.2212182 5.817790e-04 5.817790e-04 Nov 4 1.2483953 6.047455e-04 6.047455e-04 Dec 4 1.2984526 6.474138e-04 6.474138e-04 Jan 5 1.3433100 2.281812e-04 -2.509992e-03 Feb 5 1.3119575 -5.751721e-05 -5.751751e-05 Mar 5 1.3014647 -6.471395e-05 -6.471395e-05 Apr 5 1.3201518 -5.179059e-05 -5.179059e-05 May 5 1.2938699 -6.985543e-05 -6.985543e-05 Jun 5 1.2694866 -8.658868e-05 -8.658868e-05 Jul 5 1.2166229 -1.228865e-04 -1.228865e-04 Aug 5 1.2038316 -1.315934e-04 -1.315934e-04 Sep 5 1.2293140 -1.140013e-04 -1.140013e-04 Oct 5 1.2257164 -1.163923e-04 -1.163923e-04 Nov 5 1.2016328 -1.328307e-04 -1.328307e-04 Dec 5 1.1787484 -1.484246e-04 -1.484246e-04 Jan 6 1.1835565 -1.857684e-04 2.043453e-03 Feb 6 1.2102843 1.565721e-05 1.565662e-05 Mar 6 1.1937938 6.225096e-06 6.225096e-06 Apr 6 1.2019891 1.090191e-05 1.090191e-05 May 6 1.2270748 2.521400e-05 2.521400e-05 Jun 6 1.2769464 5.364888e-05 5.364888e-05 Jul 6 1.2649532 4.678070e-05 4.678070e-05 Aug 6 1.2683513 4.869028e-05 4.869028e-05 Sep 6 1.2810441 5.589080e-05 5.589080e-05 Oct 6 1.2726489 5.108085e-05 5.108085e-05 Nov 6 1.2610555 4.445715e-05 4.445715e-05 Dec 6 1.2880402 5.977280e-05 5.977280e-05 Jan 7 1.3197795 -1.382243e-04 1.520468e-03 Feb 7 1.3001625 -2.625365e-04 -2.625372e-04 Mar 7 1.3076588 -2.587518e-04 -2.587518e-04 Apr 7 1.3244504 -2.504385e-04 -2.504385e-04 May 7 1.3518370 -2.369702e-04 -2.369702e-04 Jun 7 1.3513371 -2.370983e-04 -2.370983e-04 Jul 7 1.3421415 -2.414598e-04 -2.414598e-04 Aug 7 1.3718269 -2.268968e-04 -2.268968e-04 Sep 7 1.3624314 -2.313563e-04 -2.313563e-04 Oct 7 1.3898179 -2.179300e-04 -2.179300e-04 Nov 7 1.4229017 -2.017484e-04 -2.017484e-04 Dec 7 1.4685795 -1.794660e-04 -1.794660e-04 Jan 8 1.4557679 -1.120128e-04 1.232141e-03 Feb 8 1.4718221 -2.208505e-05 -2.208552e-05 Mar 8 1.4748208 -2.079961e-05 -2.079961e-05 Apr 8 1.5526877 1.232997e-05 1.232997e-05 May 8 1.5749782 2.180200e-05 2.180200e-05 Jun 8 1.5556864 1.359392e-05 1.359392e-05 Jul 8 1.5552866 1.341830e-05 1.341830e-05 Aug 8 1.5769774 2.262313e-05 2.262313e-05 Sep 8 1.4975111 -1.111578e-05 -1.111578e-05 Oct 8 1.4369368 -3.681080e-05 -3.681080e-05 Nov 8 1.3322812 -8.117840e-05 -8.117840e-05 Dec 8 1.2733061 -1.061440e-04 -1.061440e-04 Jan 9 1.3402925 -4.188633e-04 4.607497e-03 Feb 9 1.3243952 -4.951697e-04 -4.951704e-04 Mar 9 1.2790121 -5.121085e-04 -5.121085e-04 Apr 9 1.3055019 -5.019230e-04 -5.019230e-04 May 9 1.3194965 -4.964567e-04 -4.964567e-04 Jun 9 1.3654789 -4.789373e-04 -4.789373e-04 Jul 9 1.4020650 -4.649716e-04 -4.649716e-04 Aug 9 1.4092621 -4.620857e-04 -4.620857e-04 Sep 9 1.4272551 -4.551373e-04 -4.551373e-04 Oct 9 1.4566439 -4.439051e-04 -4.439051e-04 Nov 9 1.4820342 -4.341857e-04 -4.341857e-04 Dec 9 1.4918303 -4.303382e-04 -4.303382e-04 Jan 10 1.4581775 -2.929521e-04 3.222474e-03 Feb 10 1.4276269 -4.268813e-04 -4.268820e-04 Mar 10 1.3690466 -4.465942e-04 -4.465942e-04 Apr 10 1.3573504 -4.504064e-04 -4.504064e-04 May 10 1.3410558 -4.557736e-04 -4.557736e-04 Jun 10 1.2569841 -4.840892e-04 -4.840892e-04 Jul 10 1.2212960 -4.960066e-04 -4.960066e-04 Aug 10 1.2774768 -4.768266e-04 -4.768266e-04 Sep 10 1.2898725 -4.724720e-04 -4.724720e-04 Oct 10 1.3071665 -4.664637e-04 -4.664637e-04 Nov 10 1.3902382 -4.382222e-04 -4.382222e-04 Dec 10 1.3665461 -4.460809e-04 -4.460809e-04 > m$resid Jan Feb Mar Apr May 1 0.000000000 0.719789380 -0.576589013 -0.438859085 -0.600262709 2 0.625104325 -0.617150691 -0.427738378 0.161594445 0.290723138 3 0.713132396 1.079232182 0.435620406 0.074463826 0.095953545 4 2.030158235 0.822743273 0.082616515 -1.203027634 -0.872112569 5 1.432897339 -0.923787348 -0.321960909 0.578550687 -0.809280825 6 0.159080800 0.794887083 -0.509238109 0.252644075 0.773588865 7 1.010103539 -0.579149806 0.239357362 0.526005722 0.852599933 8 -0.400885418 0.483015564 0.093188710 2.402758508 0.687260576 9 2.121682740 -0.464198007 -1.384714400 0.832962897 0.447190734 10 -1.047709085 -0.910106934 -1.793898329 -0.347023970 -0.488757745 Jun Jul Aug Sep Oct 1 -0.607129307 -0.703245894 0.176798275 1.170380546 0.266982454 2 0.943467738 1.163631854 1.112233560 -0.467481052 0.069535262 3 2.231972119 0.216525324 -0.930397067 -0.750528895 0.224400095 4 0.050433515 0.386427124 0.376843963 -0.295556975 0.111643068 5 -0.750143518 -1.628335886 -0.390859123 0.790270159 -0.107479911 6 1.537822731 -0.371658301 0.103392093 0.390086509 -0.260726322 7 -0.008110511 -0.276370706 0.923243791 -0.282852326 0.852012038 8 -0.595805392 -0.012753547 0.668725652 -2.452153295 -1.868314193 9 1.433795099 1.143390404 0.236362104 0.569309052 0.920632768 10 -2.579357347 -1.085961666 1.748348743 0.397085903 0.548054165 Nov Dec 1 -0.220419631 -0.601280598 2 -0.013789376 0.602533547 3 1.417047102 -0.002529836 4 0.820617277 1.525897468 5 -0.739460016 -0.701955083 6 -0.359245882 0.831139142 7 1.027357487 1.415379361 8 -3.227386376 -1.816816597 9 0.796939814 0.315588166 10 2.576960098 -0.717329343 > 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 > postscript(file="/var/www/html/rcomp/tmp/1dwvg1293370322.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') > grid() > dev.off() null device 1 > mylagmax <- nx/2 > postscript(file="/var/www/html/rcomp/tmp/265c11293370322.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/html/rcomp/tmp/365c11293370322.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/html/rcomp/tmp/4gxt41293370322.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/html/rcomp/tmp/5r6a71293370322.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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/6d79v1293370322.tab") > > try(system("convert tmp/1dwvg1293370322.ps tmp/1dwvg1293370322.png",intern=TRUE)) character(0) > try(system("convert tmp/265c11293370322.ps tmp/265c11293370322.png",intern=TRUE)) character(0) > try(system("convert tmp/365c11293370322.ps tmp/365c11293370322.png",intern=TRUE)) character(0) > try(system("convert tmp/4gxt41293370322.ps tmp/4gxt41293370322.png",intern=TRUE)) character(0) > try(system("convert tmp/5r6a71293370322.ps tmp/5r6a71293370322.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.211 0.854 11.836