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(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.0,8.2,8.1,8.1,8.0,7.9,7.9) > 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.000000000 0.037383359 0.000845808 0.000000000 > m$fitted level slope sea Jan 1 6.900000 0.0000000000 0.000000e+00 Feb 1 6.803283 -0.0969886640 -3.282628e-03 Mar 1 6.698290 -0.1043292034 1.709569e-03 Apr 1 6.599388 -0.0993842064 6.124066e-04 May 1 6.499994 -0.0993931569 6.444840e-06 Jun 1 6.493707 -0.0145725460 6.293414e-03 Jul 1 6.968953 0.4316601496 3.104679e-02 Aug 1 7.501774 0.5238143584 -1.773605e-03 Sep 1 7.628075 0.1616915138 -2.807475e-02 Oct 1 7.605145 -0.0064940423 -5.144695e-03 Nov 1 7.596748 -0.0082275340 3.252244e-03 Dec 1 7.786668 0.1722797084 1.333239e-02 Jan 2 8.000907 0.2104800439 -9.065038e-04 Feb 2 8.019653 0.0356723850 -1.965283e-02 Mar 2 8.001226 -0.0117173830 -1.226375e-03 Apr 2 7.901086 -0.0896642295 -1.085771e-03 May 2 7.876988 -0.0320960949 2.301187e-02 Jun 2 8.017958 0.1199823268 -1.795821e-02 Jul 2 8.469390 0.4112860679 3.060991e-02 Aug 2 9.157178 0.6542878424 4.282177e-02 Sep 2 9.449707 0.3363698976 -4.970689e-02 Oct 2 9.514560 0.0977553000 -1.455959e-02 Nov 2 9.515366 0.0125522285 -1.536590e-02 Dec 2 9.590133 0.0672226754 9.866540e-03 Jan 3 9.684958 0.0914660069 1.504225e-02 Feb 3 9.724309 0.0456356251 -2.430888e-02 Mar 3 9.603616 -0.0983308935 -3.616360e-03 Apr 3 9.496226 -0.1062100348 3.773540e-03 May 3 9.375754 -0.1185788824 2.424589e-02 Jun 3 9.339252 -0.0473841955 -3.925213e-02 Jul 3 9.596231 0.2167110625 3.768955e-03 Aug 3 10.104887 0.4700316807 9.511348e-02 Sep 3 10.255384 0.1927812601 -5.538391e-02 Oct 3 10.127540 -0.0854180278 -2.754024e-02 Nov 3 9.927705 -0.1846953829 -2.770513e-02 Dec 3 9.789920 -0.1440023033 1.007965e-02 Jan 4 9.773237 -0.0335658220 2.676256e-02 Feb 4 9.708855 -0.0602999034 -8.854856e-03 Mar 4 9.516870 -0.1736957835 -1.686987e-02 Apr 4 9.289000 -0.2204822510 1.100015e-02 May 4 9.063834 -0.2245208852 3.616573e-02 Jun 4 9.049982 -0.0429133763 -4.998240e-02 Jul 4 9.510088 0.3908787970 -1.008804e-02 Aug 4 9.885864 0.3778538901 1.141358e-01 Sep 4 10.224388 0.3439346301 -2.438756e-02 Oct 4 10.147905 -0.0186387524 -4.790515e-02 Nov 4 10.034329 -0.1005095656 -3.432913e-02 Dec 4 9.910080 -0.1209759283 -1.007999e-02 Jan 5 9.959248 0.0257379536 4.075197e-02 Feb 5 9.903304 -0.0446631639 -3.304173e-03 Mar 5 9.718909 -0.1646072464 -1.890945e-02 Apr 5 9.474967 -0.2328308639 2.503346e-02 May 5 9.174292 -0.2911360366 2.570804e-02 Jun 5 9.099038 -0.1057155898 -9.903758e-02 Jul 5 9.291611 0.1505672824 8.389436e-03 Aug 5 9.681117 0.3558813380 1.188831e-01 Sep 5 9.795520 0.1483850208 4.479746e-03 Oct 5 9.659187 -0.0962628817 -5.918737e-02 Nov 5 9.436263 -0.2050863170 -3.626350e-02 Dec 5 9.329227 -0.1208658910 -2.922679e-02 Jan 6 9.159874 -0.1625266474 4.012618e-02 Feb 6 9.173158 -0.0115699047 2.684236e-02 Mar 6 9.019338 -0.1334008682 -1.933752e-02 Apr 6 8.759367 -0.2419307164 4.063264e-02 May 6 8.671787 -0.1096000657 2.821256e-02 Jun 6 8.813434 0.1056652318 -1.134344e-01 Jul 6 9.123805 0.2810940835 -2.380520e-02 Aug 6 9.549958 0.4054252102 1.500423e-01 Sep 6 9.776995 0.2525244438 2.300482e-02 Oct 6 9.671413 -0.0544100857 -7.141309e-02 Nov 6 9.462959 -0.1864224725 -6.295906e-02 Dec 6 9.406840 -0.0747752818 -6.840086e-03 Jan 7 9.478920 0.0510911014 2.108004e-02 Feb 7 9.367694 -0.0879282740 3.230561e-02 Mar 7 9.287351 -0.0814431863 1.264890e-02 Apr 7 9.168323 -0.1136044826 3.167662e-02 May 7 8.999830 -0.1605763932 1.700293e-04 Jun 7 9.025077 -0.0016505577 -1.250767e-01 Jul 7 9.241628 0.1849910272 -4.162801e-02 Aug 7 9.624373 0.3541714038 1.756268e-01 Sep 7 9.841048 0.2365382598 5.895187e-02 Oct 7 9.678299 -0.1050542697 -7.829897e-02 Nov 7 9.305052 -0.3344572268 -1.050524e-01 Dec 7 9.121625 -0.2052859352 -2.162462e-02 Jan 8 9.044461 -0.0956785397 5.553898e-02 Feb 8 8.967755 -0.0794587842 3.224515e-02 Mar 8 8.878547 -0.0877827058 2.145267e-02 Apr 8 8.657692 -0.2014763753 4.230796e-02 May 8 8.508339 -0.1569356058 -8.339317e-03 Jun 8 8.445583 -0.0764988489 -1.455828e-01 Jul 8 8.568830 0.0941082771 -6.882980e-02 Aug 8 8.537397 -0.0131377250 1.626031e-01 Sep 8 8.309242 -0.1968287051 9.075810e-02 Oct 8 8.129903 -0.1818878399 -2.990277e-02 Nov 8 7.924204 -0.2022252145 -1.242045e-01 Dec 8 7.738561 -0.1880627444 -3.856120e-02 Jan 9 7.458426 -0.2667169916 4.157397e-02 Feb 9 7.170883 -0.2844971438 2.911711e-02 Mar 9 6.763938 -0.3889373381 3.606219e-02 Apr 9 6.633877 -0.1680277697 6.612308e-02 May 9 6.421890 -0.2055476489 -2.189045e-02 Jun 9 6.461721 0.0038001085 -1.617213e-01 Jul 9 6.826185 0.3115002219 -2.618495e-02 Aug 9 7.107605 0.2858335164 1.923945e-01 Sep 9 7.044097 -0.0122731229 5.590346e-02 Oct 9 7.031134 -0.0128616769 -3.113368e-02 Nov 9 6.941305 -0.0785281800 -1.413049e-01 Dec 9 6.647719 -0.2620082698 -4.771906e-02 Jan 10 6.265491 -0.3645913337 3.450856e-02 Feb 10 6.030908 -0.2537168143 6.909235e-02 Mar 10 6.067944 -0.0059360114 3.205615e-02 Apr 10 6.194999 0.1074423568 1.050005e-01 May 10 6.341108 0.1404135078 -4.110768e-02 Jun 10 6.244367 -0.0617427683 -2.443672e-01 Jul 10 6.232317 -0.0193855912 -3.231730e-02 Aug 10 6.165983 -0.0594091640 2.340166e-01 Sep 10 6.701150 0.4474992828 9.884994e-02 Oct 10 7.498169 0.7454710048 1.830752e-03 Nov 10 7.658188 0.2464238067 -1.581876e-01 Dec 10 7.641682 0.0222948617 -4.168181e-02 Jan 11 7.583141 -0.0466192986 1.685863e-02 Feb 11 7.386360 -0.1745740997 1.364018e-02 Mar 11 7.286325 -0.1110953238 1.367450e-02 Apr 11 7.020784 -0.2426628958 7.921603e-02 May 11 6.888457 -0.1486494154 1.154256e-02 Jun 11 7.010897 0.0822717504 -2.108971e-01 Jul 11 7.463619 0.3978058302 3.638077e-02 Aug 11 7.487083 0.0789174881 1.129175e-01 Sep 11 7.764004 0.2476001111 3.599629e-02 Oct 11 7.934016 0.1815048989 6.598352e-02 Nov 11 8.218086 0.2688693948 -1.180864e-01 Dec 11 8.256307 0.0723955720 -5.630689e-02 Jan 12 8.267103 0.0199194740 3.289664e-02 Feb 12 8.206199 -0.0489041845 -6.199179e-03 Mar 12 7.967350 -0.2105706585 3.265033e-02 Apr 12 7.815506 -0.1605740980 8.449356e-02 May 12 7.624948 -0.1861062921 -2.494809e-02 Jun 12 7.838514 0.1541484378 -2.385141e-01 Jul 12 8.183293 0.3164229471 1.167069e-01 Aug 12 8.330323 0.1722123332 6.967748e-02 Sep 12 8.366589 0.0564700831 3.341052e-02 Oct 12 8.367562 0.0092215993 3.243830e-02 Nov 12 8.482921 0.0995754429 -8.292070e-02 Dec 12 8.649521 0.1566359844 -4.952082e-02 Jan 13 8.855042 0.1982555333 4.495832e-02 Feb 13 8.794551 -0.0219504528 5.448705e-03 Mar 13 8.306846 -0.4181744616 -6.846218e-03 Apr 13 7.435625 -0.8036672934 6.437463e-02 May 13 7.233673 -0.2915677233 -3.367250e-02 Jun 13 7.617249 0.2829269124 -2.172492e-01 Jul 13 8.595629 0.8746398604 2.043711e-01 Aug 13 9.222729 0.6640094405 7.727129e-02 Sep 13 9.301483 0.1659901075 -1.482686e-03 Oct 13 8.751725 -0.4430516677 -5.172541e-02 Nov 13 8.312024 -0.4402010093 -1.120240e-01 Dec 13 8.345337 -0.0372778965 -4.533732e-02 Jan 14 8.425430 0.0625978340 7.457008e-02 Feb 14 8.510724 0.0819047894 8.927558e-02 Mar 14 8.407129 -0.0758388810 9.287104e-02 Apr 14 8.197770 -0.1894004876 2.230403e-03 May 14 8.206416 -0.0209251164 -1.064162e-01 Jun 14 8.246217 0.0307263236 -3.462168e-01 Jul 14 8.386244 0.1236841017 2.137561e-01 Aug 14 8.552514 0.1599039015 1.474865e-01 Sep 14 8.591973 0.0574585603 1.080266e-01 Oct 14 8.542544 -0.0334544450 -4.254372e-02 Nov 14 8.575635 0.0231433876 -1.756349e-01 Dec 14 8.570796 -0.0006574705 -7.079589e-02 Jan 15 8.631399 0.0514493130 6.860079e-02 Feb 15 8.589703 -0.0277530394 1.102966e-01 Mar 15 8.483862 -0.0941333337 1.161376e-01 Apr 15 8.512171 0.0099662753 -1.217055e-02 May 15 8.420608 -0.0763688422 -1.206082e-01 Jun 15 8.362602 -0.0607560729 -3.626016e-01 Jul 15 8.023224 -0.2976319517 1.767760e-01 Aug 15 7.920354 -0.1320462685 1.796464e-01 Sep 15 7.959714 0.0136895472 1.402859e-01 Oct 15 8.044860 0.0744428470 -4.485973e-02 Nov 15 8.073949 0.0358828526 -1.739486e-01 Dec 15 7.993904 -0.0626846394 -9.390447e-02 > m$resid Jan Feb Mar Apr May 1 0.000000e+00 -5.097119e-01 -3.941627e-02 2.548679e-02 -4.630884e-05 2 1.977434e-01 -9.114457e-01 -2.480915e-01 -4.028511e-01 2.977022e-01 3 1.255295e-01 -2.374808e-01 -7.474498e-01 -4.079103e-02 -6.393141e-02 4 5.718403e-01 -1.382885e-01 -5.873651e-01 -2.422851e-01 -2.087386e-02 5 7.595117e-01 -3.640204e-01 -6.208077e-01 -3.532458e-01 -3.013955e-01 6 -2.156171e-01 7.804954e-01 -6.303807e-01 -5.618250e-01 6.841620e-01 7 6.512995e-01 -7.187893e-01 3.355039e-02 -1.664590e-01 -2.428801e-01 8 5.670860e-01 8.386619e-02 -4.306006e-02 -5.883680e-01 2.303305e-01 9 -4.068995e-01 -9.193789e-02 -5.402475e-01 1.143090e+00 -1.940363e-01 10 -5.306512e-01 5.733308e-01 1.281676e+00 5.866245e-01 1.705198e-01 11 -3.564670e-01 -6.616714e-01 3.283441e-01 -6.806925e-01 4.862327e-01 12 -2.714288e-01 -3.559046e-01 -8.362061e-01 2.586548e-01 -1.320539e-01 13 2.152681e-01 -1.138763e+00 -2.049409e+00 -1.994249e+00 2.648647e+00 14 5.165750e-01 9.984468e-02 -8.158976e-01 -5.874636e-01 8.713858e-01 15 2.695014e-01 -4.095952e-01 -3.433362e-01 5.385022e-01 -4.465444e-01 Jun Jul Aug Sep Oct 1 4.386919e-01 2.307933e+00 4.766241e-01 -1.872909e+00 -8.698604e-01 2 7.866303e-01 1.506620e+00 1.256815e+00 -1.644280e+00 -1.234122e+00 3 3.682790e-01 1.365897e+00 1.310182e+00 -1.433947e+00 -1.438857e+00 4 9.393656e-01 2.243626e+00 -6.736471e-02 -1.754316e-01 -1.875252e+00 5 9.589939e-01 1.325561e+00 1.061879e+00 -1.073180e+00 -1.265341e+00 6 1.113266e+00 9.073735e-01 6.430388e-01 -7.908103e-01 -1.587494e+00 7 8.218638e-01 9.653651e-01 8.750028e-01 -6.084042e-01 -1.766744e+00 8 4.159597e-01 8.824181e-01 -5.546803e-01 -9.500575e-01 7.727507e-02 9 1.082589e+00 1.591466e+00 -1.327496e-01 -1.541818e+00 -3.044027e-03 10 -1.045406e+00 2.190732e-01 -2.070044e-01 2.621746e+00 1.541120e+00 11 1.194171e+00 1.631932e+00 -1.649310e+00 8.724311e-01 -3.418466e-01 12 1.759595e+00 8.392687e-01 -7.458650e-01 -5.986220e-01 -2.443710e-01 13 2.970986e+00 3.060257e+00 -1.089389e+00 -2.575771e+00 -3.149996e+00 14 2.671178e-01 4.807616e-01 1.873297e-01 -5.298507e-01 -4.702084e-01 15 8.074317e-02 -1.225076e+00 8.564105e-01 7.537513e-01 3.142215e-01 Nov Dec 1 -8.965667e-03 9.335885e-01 2 -4.406743e-01 2.827592e-01 3 -5.134685e-01 2.104756e-01 4 -4.234372e-01 -1.058659e-01 5 -5.628331e-01 4.356746e-01 6 -6.827678e-01 5.775750e-01 7 -1.186482e+00 6.682368e-01 8 -1.051870e-01 7.326550e-02 9 -3.396377e-01 -9.491646e-01 10 -2.581176e+00 -1.159420e+00 11 4.518708e-01 -1.016337e+00 12 4.673350e-01 2.951616e-01 13 1.474445e-02 2.084192e+00 14 2.927415e-01 -1.231121e-01 15 -1.994445e-01 -5.098414e-01 > 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/html/rcomp/tmp/1dw211259934571.ps",horizontal=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/2tcm41259934571.ps",horizontal=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/3a7r61259934571.ps",horizontal=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/4n34k1259934571.ps",horizontal=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/html/rcomp/tmp/59isg1259934571.ps",horizontal=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/6qois1259934571.tab") > system("convert tmp/1dw211259934571.ps tmp/1dw211259934571.png") > system("convert tmp/2tcm41259934571.ps tmp/2tcm41259934571.png") > system("convert tmp/3a7r61259934571.ps tmp/3a7r61259934571.png") > system("convert tmp/4n34k1259934571.ps tmp/4n34k1259934571.png") > system("convert tmp/59isg1259934571.ps tmp/59isg1259934571.png") > > > proc.time() user system elapsed 2.591 0.899 7.262