R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(9.82,9.94,9.9,9.8,9.86,10.5,10.33,10.16,9.91,9.96,10.03,9.55,9.51,9.8,10.08,10.2,10.23,10.2,10.07,10.01,10.05,9.92,10.03,10.18,10.1,10.16,10.15,10.13,10.09,10.18,10.06,9.65,9.74,9.53,9.5,9,9.15,9.32,9.62,9.59,9.37,9.35,9.32,9.49,9.52,9.59,9.35,9.2,9.57,9.78,9.79,9.57,9.53,9.65,9.36,9.4,9.32,9.31,9.19,9.39,9.28,9.28,9.31,9.28,9.31,9.35,9.19,9.07,8.96,8.69,8.58,8.56,8.47,8.46,8.75,8.95,9.33,9.51,9.561,9.94,9.9,9.275,9.56,9.779,9.746,9.991,9.98,10.195,10.31,10.25,9.871,10.06,9.894,9.59,9.64,9.89,9.53,9.388,9.16,9.418,9.57,9.857,9.877,9.76,9.76,9.695,9.475,9.262,9.097,8.55,8.16,7.532,7.325,6.749,7.13,6.995,7.346,7.73,7.837,7.514,7.58,6.83,6.617,6.715,6.63,6.891,7.002,7.09,7.36,7.477,7.826,7.79,7.578,7.204,7.198,7.685,7.795,7.46,7.274,7.33,7.655,7.767,7.84,7.424,7.54,7.351,6.735,6.777,6.679,7.34,6.978,6.92,6.628,6.385,5.984,6.268,6.596,6.395,6.715,6.804,6.929,6.846,6.992,6.774,6.75,6.485,6.27,6.47,6.78,6.71,6.141,6.72,6.68,6.371,6.097,6.27,6.447,6.37,6.446,6.54,6.374,6.33,6.63) > par1 = '5' > #'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.05953321 0.00000000 0.00000000 0.00000000 > m$fitted Time Series: Start = c(1, 1) End = c(37, 3) Frequency = 5 level slope sea 1.0 9.820000 0.000000000 0.000000000 1.2 9.922000 0.017999999 0.017999999 1.4 9.883415 0.016585365 0.016585365 1.6 9.786190 0.013809523 0.013809523 1.8 9.845116 0.014883720 0.014883720 2.0 10.369831 -0.032542371 0.130169485 2.2 10.360947 -0.030947367 -0.030947367 2.4 10.192396 -0.032395832 -0.032395832 2.6 9.944639 -0.034639174 -0.034639174 2.8 9.993776 -0.033775509 -0.033775509 3.0 9.904035 -0.031491227 0.125964909 3.2 9.593133 -0.043133332 -0.043133332 3.4 9.553113 -0.043112582 -0.043112582 3.6 9.840921 -0.040921052 -0.040921052 3.8 10.118824 -0.038823529 -0.038823529 4.0 10.048047 -0.037988165 0.151952660 4.2 10.260439 -0.030439024 -0.030439024 4.4 10.230437 -0.030436893 -0.030436893 4.6 10.100918 -0.030917874 -0.030917874 4.8 10.041058 -0.031057692 -0.031057692 5.0 9.931786 -0.029553571 0.118214284 5.2 9.948462 -0.028461538 -0.028461538 5.4 10.057931 -0.027931034 -0.027931034 5.6 10.207252 -0.027251908 -0.027251908 5.8 10.127452 -0.027452471 -0.027452471 6.0 10.053047 -0.026738351 0.106953404 6.2 10.173873 -0.023873016 -0.023873016 6.4 10.153861 -0.023860759 -0.023860759 6.6 10.113912 -0.023911672 -0.023911672 6.8 10.203553 -0.023553459 -0.023553459 7.0 9.976048 -0.020988024 0.083952095 7.2 9.675595 -0.025594594 -0.025594594 7.4 9.765283 -0.025283019 -0.025283019 7.6 9.555780 -0.025779570 -0.025779570 7.8 9.525791 -0.025790885 -0.025790885 8.0 8.921645 -0.019588689 0.078354755 8.2 9.165812 -0.015811765 -0.015811765 8.4 9.335376 -0.015375587 -0.015375587 8.6 9.634637 -0.014637002 -0.014637002 8.8 9.604673 -0.014672897 -0.014672897 9.0 9.321351 -0.012162162 0.048648648 9.2 9.361500 -0.011500000 -0.011500000 9.4 9.331538 -0.011538461 -0.011538461 9.6 9.501162 -0.011161826 -0.011161826 9.8 9.531077 -0.011076604 -0.011076604 10.0 9.544870 -0.011282565 0.045130260 10.2 9.363215 -0.013214953 -0.013214953 10.4 9.213470 -0.013470149 -0.013470149 10.6 9.582756 -0.012756052 -0.012756052 10.8 9.792342 -0.012342007 -0.012342007 11.0 9.741769 -0.012057762 0.048231047 11.2 9.583559 -0.013559322 -0.013559322 11.4 9.543604 -0.013604061 -0.013604061 11.6 9.663378 -0.013378378 -0.013378378 11.8 9.373845 -0.013844857 -0.013844857 12.0 9.345025 -0.013743842 0.054975369 12.2 9.333721 -0.013720930 -0.013720930 12.4 9.323715 -0.013715170 -0.013715170 12.6 9.203879 -0.013879444 -0.013879444 12.8 9.403549 -0.013549383 -0.013549383 13.0 9.229759 -0.012560241 0.050240964 13.2 9.291914 -0.011914286 -0.011914286 13.4 9.321854 -0.011854494 -0.011854494 13.6 9.291880 -0.011880342 -0.011880342 13.8 9.321821 -0.011820768 -0.011820768 14.0 9.302879 -0.011780250 0.047121001 14.2 9.202490 -0.012490066 -0.012490066 14.4 9.082632 -0.012632275 -0.012632275 14.6 8.972761 -0.012760898 -0.012760898 14.8 8.703100 -0.013100264 -0.013100264 15.0 8.530956 -0.012260982 0.049043927 15.2 8.571864 -0.011864197 -0.011864197 15.4 8.481961 -0.011960542 -0.011960542 15.6 8.471958 -0.011958128 -0.011958128 15.8 8.761587 -0.011586716 -0.011586716 16.0 8.900688 -0.012328106 0.049312424 16.2 9.339179 -0.009179191 -0.009179191 16.4 9.518961 -0.008960739 -0.008960739 16.6 9.569892 -0.008891580 -0.008891580 16.8 9.948445 -0.008444700 -0.008444700 17.0 9.867557 -0.008110860 0.032443439 17.2 9.286870 -0.011869565 -0.011869565 17.4 9.571547 -0.011547231 -0.011547231 17.6 9.790297 -0.011297180 -0.011297180 17.8 9.757321 -0.011320693 -0.011320693 18.0 9.942314 -0.012171459 0.048685836 18.2 9.991790 -0.011789744 -0.011789744 18.4 10.206557 -0.011557377 -0.011557377 18.6 10.321428 -0.011427840 -0.011427840 18.8 10.261478 -0.011477505 -0.011477505 19.0 9.831930 -0.009767606 0.039070422 19.2 10.068325 -0.008325243 -0.008325243 19.4 9.902478 -0.008478177 -0.008478177 19.6 9.598765 -0.008764535 -0.008764535 19.8 9.648708 -0.008707648 -0.008707648 20.0 9.851888 -0.009528122 0.038112488 20.2 9.541203 -0.011202765 -0.011202765 20.4 9.399323 -0.011323204 -0.011323204 20.6 9.171523 -0.011522539 -0.011522539 20.8 9.429275 -0.011274816 -0.011274816 21.0 9.523351 -0.011662138 0.046648551 21.2 9.866783 -0.009783333 -0.009783333 21.4 9.886757 -0.009757230 -0.009757230 21.6 9.769851 -0.009851138 -0.009851138 21.8 9.769843 -0.009842520 -0.009842520 22.0 9.657071 -0.009482312 0.037929249 22.2 9.485301 -0.010301255 -0.010301255 22.4 9.272471 -0.010470736 -0.010470736 22.6 9.107600 -0.010599833 -0.010599833 22.8 8.561048 -0.011047579 -0.011047579 23.0 8.121532 -0.009616969 0.038467875 23.2 7.544354 -0.012354400 -0.012354400 23.4 7.337510 -0.012509992 -0.012509992 23.6 6.761960 -0.012960064 -0.012960064 23.8 7.142646 -0.012645650 -0.012645650 24.0 6.946757 -0.012060678 0.048242711 24.2 7.356114 -0.010114176 -0.010114176 24.4 7.739812 -0.009812404 -0.009812404 24.6 7.846723 -0.009723030 -0.009723030 24.8 7.523963 -0.009962538 -0.009962538 25.0 7.539834 -0.010041541 0.040166163 25.2 6.843085 -0.013084559 -0.013084559 25.4 6.630231 -0.013231447 -0.013231447 25.6 6.728150 -0.013149780 -0.013149780 25.8 6.643202 -0.013202494 -0.013202494 26.0 6.835774 -0.013806381 0.055225526 26.2 7.014984 -0.012984452 -0.012984452 26.4 7.102913 -0.012913136 -0.012913136 26.6 7.372713 -0.012713479 -0.012713479 26.8 7.489622 -0.012622003 -0.012622003 27.0 7.772181 -0.013454672 0.053818689 27.2 7.803272 -0.013272109 -0.013272109 27.4 7.591407 -0.013407206 -0.013407206 27.6 7.217652 -0.013652174 -0.013652174 27.8 7.211647 -0.013646979 -0.013646979 28.0 7.625766 -0.014808596 0.059234385 28.2 7.809026 -0.014026229 -0.014026229 28.4 7.474237 -0.014236566 -0.014236566 28.6 7.288349 -0.014349050 -0.014349050 28.8 7.344303 -0.014303010 -0.014303010 29.0 7.595013 -0.014996762 0.059987047 29.2 7.781230 -0.014229747 -0.014229747 29.4 7.854175 -0.014174573 -0.014174573 29.6 7.438429 -0.014428571 -0.014428571 29.8 7.554346 -0.014346178 -0.014346178 30.0 7.296081 -0.013729831 0.054919324 30.2 6.750688 -0.015688073 -0.015688073 30.4 6.792653 -0.015652812 -0.015652812 30.6 6.694703 -0.015703115 -0.015703115 30.8 7.355290 -0.015289988 -0.015289988 31.0 6.920933 -0.014266626 0.057066505 31.2 6.934169 -0.014168639 -0.014168639 31.4 6.642333 -0.014332939 -0.014332939 31.6 6.399468 -0.014468085 -0.014468085 31.8 5.998696 -0.014696397 -0.014696397 32.0 6.207106 -0.015223522 0.060894090 32.2 6.609782 -0.013781662 -0.013781662 32.4 6.408889 -0.013888889 -0.013888889 32.6 6.728698 -0.013697768 -0.013697768 32.8 6.817639 -0.013639016 -0.013639016 33.0 6.873805 -0.013798753 0.055195011 33.2 6.859799 -0.013799444 -0.013799444 33.4 7.005711 -0.013710716 -0.013710716 33.6 6.787824 -0.013824084 -0.013824084 33.8 6.763830 -0.013829728 -0.013829728 34.0 6.432499 -0.013125344 0.052501374 34.2 6.283566 -0.013566038 -0.013566038 34.4 6.483451 -0.013450970 -0.013450970 34.6 6.793277 -0.013276790 -0.013276790 34.8 6.723307 -0.013307320 -0.013307320 35.0 6.093083 -0.011979189 0.047916756 35.2 6.729935 -0.009934555 -0.009934555 35.4 6.689950 -0.009950288 -0.009950288 35.6 6.381107 -0.010106695 -0.010106695 35.8 6.107245 -0.010244642 -0.010244642 36.0 6.227926 -0.010518403 0.042073613 36.2 6.456785 -0.009785242 -0.009785242 36.4 6.379819 -0.009819430 -0.009819430 36.6 6.455776 -0.009775801 -0.009775801 36.8 6.549723 -0.009723069 -0.009723069 37.0 6.336760 -0.009309980 0.037239919 37.2 6.339275 -0.009274752 -0.009274752 37.4 6.639122 -0.009121722 -0.009121722 > m$resid Time Series: Start = c(1, 1) End = c(37, 3) Frequency = 5 [1] 0.0000000000 0.1555255541 -0.2347936835 -0.4720974745 0.1870954498 [6] 2.4475859886 0.0815677804 -0.5669251977 -0.8872322447 0.3451156112 [11] -0.2473862434 -1.0399170389 0.0127992343 1.3607491596 1.3109757066 [16] -0.1376337719 0.9598136860 0.0017949480 -0.4070682573 -0.1189049724 [21] -0.3326586144 0.1800178284 0.5663904611 0.7278496364 -0.2157743834 [26] -0.1982036587 0.5802323575 0.0158482511 -0.0660415669 0.4661274241 [31] -0.8566594353 -1.1061676187 0.4731205272 -0.7560363314 -0.0172740490 [36] -2.4206670231 1.0490027965 0.7606471312 1.2910387928 -0.0628909824 [41] -1.1214363232 0.2088072473 -0.0757425931 0.7432553227 0.1685252349 [46] 0.1036020399 -0.6820098336 -0.5600844020 1.5701717987 0.9121071827 [51] -0.1590011593 -0.5863983981 -0.1082742569 0.5471077970 -1.1327654340 [56] -0.0621983975 0.0098089617 0.0152382634 -0.4352670164 0.8758990218 [61] -0.6647991311 0.3008185391 0.1716613163 -0.0743155859 0.1715226468 [66] -0.0295153678 -0.3572339620 -0.4403333011 -0.3987937460 -1.0535876709 [71] -0.6586782571 0.2146034325 -0.3200387149 0.0080302493 1.2368009912 [76] 0.6236340172 1.8214423070 0.7748949480 0.2456047334 1.5888408498 [81] -0.2996302702 -2.3154075900 1.2160463637 0.9443753094 -0.0888998722 [86] 0.8115288046 0.2494846916 0.9290116655 0.5184244202 -0.1989690962 [91] -1.7274025903 0.9969088697 -0.6459097041 -1.2105964621 0.2407273025 [96] 0.8751113233 -1.2203768160 -0.5358199486 -0.8876319034 1.1041187171 [101] 0.4349416147 1.4397517887 0.1220122016 -0.4393373739 0.0403567991 [106] -0.4247934057 -0.6583372013 -0.8304046657 -0.6330669043 -2.1974951697 [111] -1.7677447582 -2.3034388480 -0.7974276697 -2.3085169534 1.6139838569 [116] -0.7557920887 1.7110389946 1.6146413953 0.4785674053 -1.2834612178 [121] 0.1065244727 -2.7892476873 -0.8190437296 0.4557098921 -0.2943669773 [126] 0.8482933543 0.7842668134 0.4137342420 1.1590980417 0.5314375977 [131] 1.2165940165 0.1810573123 -0.8142007789 -1.4773718972 0.0313514564 [136] 1.7626748394 0.8053076549 -1.3150660240 -0.7037344645 0.2882281800 [141] 1.0918159426 0.8183235619 0.3573942647 -1.6463435582 0.5343869920 [146] -1.0047322477 -2.1628113254 0.2363598045 -0.3373932917 2.7725917419 [151] -1.7258939756 0.1119051395 -1.1383430840 -0.9369050778 -1.5837164110 [156] 0.9187005694 1.7008309125 -0.7670865012 1.3680374695 0.4207819481 [161] 0.2873990950 -0.0008418141 0.6547492652 -0.8370384485 -0.0416939833 [166] -1.3070266839 -0.5529612410 0.8750553407 1.3252928355 -0.2324150523 [171] -2.5392698892 2.6423244765 -0.1231896824 -1.2253217622 -1.0812725815 [176] 0.5388354621 0.9750260118 -0.2754067120 0.3516378067 0.4252125600 [181] -0.8363492256 0.0481721205 1.2672355694 > 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/wessaorg/rcomp/tmp/1rwqh1322232820.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/wessaorg/rcomp/tmp/2imwy1322232820.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/wessaorg/rcomp/tmp/33xx01322232820.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/wessaorg/rcomp/tmp/4mx8n1322232820.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/wessaorg/rcomp/tmp/5zok31322232820.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/6y5rv1322232820.tab") > > try(system("convert tmp/1rwqh1322232820.ps tmp/1rwqh1322232820.png",intern=TRUE)) character(0) > try(system("convert tmp/2imwy1322232820.ps tmp/2imwy1322232820.png",intern=TRUE)) character(0) > try(system("convert tmp/33xx01322232820.ps tmp/33xx01322232820.png",intern=TRUE)) character(0) > try(system("convert tmp/4mx8n1322232820.ps tmp/4mx8n1322232820.png",intern=TRUE)) character(0) > try(system("convert tmp/5zok31322232820.ps tmp/5zok31322232820.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.429 0.233 2.676