Home » date » 2010 » Dec » 28 »

Structural Time Series Models

*The author of this computation has been verified*
R Software Module: /rwasp_structuraltimeseries.wasp (opens new window with default values)
Title produced by software: Structural Time Series Models
Date of computation: Tue, 28 Dec 2010 11:49:59 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd.htm/, Retrieved Tue, 28 Dec 2010 12:48:34 +0100
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd.htm/},
    year = {2010},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2010},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
621 587 655 517 646 657 382 345 625 654 606 510 614 647 580 614 636 388 356 639 753 611 639 630 586 695 552 619 681 421 307 754 690 644 643 608 651 691 627 634 731 475 337 803 722 590 724 627 696 825 677 656 785 412 352 839 729 696 641 695 638 762 635 721 854 418 367 824 687 601 676 740 691 683 594 729 731 386 331 706 715 657 653 642 643 718 654 632 731 392 344 792 852 649 629 685 617 715 715 629 916 531 357 917 828 708 858 775 785 1006 789 734 906 532 387 991 841 892 782 813 793 978 775 797 946 594 438 1022 868 795
 
Output produced by software:


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time6 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
1621621000
2587608.77098293182-0.457029630606978-15.1574639493343-0.46781160979471
3655624.5852722197810.84124585290168225.40033350528640.428890000761588
4517586.465726157435-1.92478391657941-55.4286075192865-1.18105343404841
5646599.850778532084-1.0861238271918239.67893504150960.522285943566346
6657622.25515888051-0.10525844170840024.02155486551930.845927991724805
7382546.008355326935-2.67664199316742-128.113390545872-2.80183895345711
8345459.943035686867-5.13740127537003-75.120546104286-3.09400965205076
9625494.706815567802-4.04485749192906111.1423561679581.48496242341417
10654556.308470751571-2.3185183065184366.12518194531682.44557844414699
11606587.525480990667-1.457981427159962.337426040310281.24971155673083
12510568.697202855142-1.89552278121732-50.3357120615608-0.64738744682891
13614572.250500305224-2.0861018505868538.92125237872270.230969132616398
14647600.983265593104-1.9900997645981731.54955905062491.17235415241348
15580586.226037070328-2.35599813800913-1.03972473354552-0.433850432379405
16614614.342559589628-1.25319274740779-12.41702034978911.02770463716922
17636612.031960869023-1.2900199622693924.4031411983240-0.0369297761523492
18388511.692876005303-4.303396568697-81.2797777888639-3.57073956757405
19356466.307425345646-5.37321938506412-92.2585362686458-1.50955357530999
20639542.802123574905-3.5102615106335459.72565108006573.03785386079080
21753602.841823609167-2.2078727964014121.6446638929492.36909371732910
22611603.258776300688-2.159079543636936.558973157308870.0980474355147776
23639611.819851252373-1.9881540790763722.33645198266410.400822062084261
24630638.442512506838-1.67518347796536-21.44729617608561.07341239749444
25586622.133358808472-1.69302677303452-29.3440153369266-0.56116244342708
26695630.205336756158-1.6132588962070560.3808654662040.365476329508416
27552608.750192802577-1.97329989298572-48.2275917249707-0.71296342829598
28619600.689339908611-2.1194867930090220.8596004778360-0.215358333088907
29681594.383044764793-2.2266770477639288.3789033877845-0.149342826050015
30421562.111760846053-2.96508938111127-128.245552105742-1.08870869752609
31307524.024981542537-3.75439885877948-201.732348792529-1.28987195686643
32754580.767433379845-2.53303674714980146.5803205608592.24120703380798
33690589.542584793103-2.3293896658794995.43934176685760.420932197722659
34644609.851502485735-1.9713094282745424.05950765331500.844552864550726
35643621.776542187702-1.7856013087011515.01206554861080.519041157009959
36608623.540824294328-1.74782442418364-17.13272747600610.132858990255110
37651640.94101018189-1.582205768016071.446039560927860.718483062662077
38691635.631699085548-1.6233244369828757.0258623707766-0.138443997933265
39627643.483111289272-1.47791578234435-20.60804721534000.345998611251437
40634630.627411607222-1.692178337934958.25242546629732-0.411386558057923
41731623.946802266965-1.79447254940086109.188924797363-0.180569852188678
42475613.686350554475-1.96866576009505-135.035385432936-0.308747886460838
43337600.806323844922-2.18271197697785-259.054757747277-0.401258546006242
44803619.097284026921-1.81128030894418174.9125558026090.75771959755711
45722630.18207267864-1.5990338175648386.12231281809330.479133557912105
46590615.453374009324-1.79214434148784-19.6337033381906-0.488783055232906
47724643.120877435123-1.4090020508072367.79197172890041.09784679736256
48627652.16828426199-1.28745567322089-29.81987026185830.389928755431202
49696666.339324084548-1.1150824710921822.78835523610920.575971901724822
50825701.292844903496-0.671393384782864107.7720658076771.3365663954281
51677704.123634514612-0.620918729099026-28.65507495991370.128719650590822
52656684.98296158411-0.924748997579368-20.9516605022626-0.676826656574083
53785676.060030419167-1.06572357526415112.400273080222-0.292168275896699
54412633.10719804537-1.81711738242252-202.930856972486-1.53555949633318
55352621.818262874004-1.98298519254837-265.685510422510-0.348938324879473
56839634.405431249039-1.74108437046113198.2027538248260.539045358103248
57729639.357579730207-1.6377162893942186.69397545416480.248332286286509
58696671.15813964896-1.1620968244313910.07201429609031.24259482556811
59641651.280535083776-1.40775901034266-2.00071385198322-0.696024750007052
60695675.560517673485-1.089780420441738.068728491833650.955428323014933
61638667.57848435152-1.17418726961684-26.5309242129937-0.256055514260866
62762659.300742226267-1.26566166259239105.828715770000-0.263065293459633
63635652.278610715343-1.34626880522629-14.7563856761802-0.212260059134228
64721672.985772032546-1.0121085567364838.39638555631510.810567366105447
65854689.751806449676-0.728500241438924156.5087978886570.65301587060007
66418671.208813117774-1.01793830502444-245.44387303271-0.655482137368702
67367659.528943872454-1.18917309756548-287.867428218858-0.393414750224318
68824649.957025133187-1.31922044538525177.720438402894-0.310153172232603
69687637.734297143313-1.4801739548318154.0623919102231-0.404212492074054
70601618.137899936111-1.73309585227055-9.15290568198557-0.672387330779044
71676636.274103360507-1.4694764619362130.95868544805010.737858622326889
72740667.135621242642-1.0545225442345058.59497413817071.20058086039231
73691687.600410432093-0.77940423008278-6.089847078527060.798392170950982
74683658.013798118804-1.1580272896839437.6614294848401-1.06675151639112
75594641.188822704551-1.37382979987935-40.3163121777086-0.578763224685468
76729653.955892675977-1.1695365789146368.85757464928390.52141944534227
77731625.995007377817-1.57011764564309116.711920097518-0.98738172003967
78386618.012122023127-1.66741466902773-229.208483631222-0.236542346122302
79331613.118539412001-1.71610409726735-280.705660102587-0.119194125160116
80706582.451149916966-2.14363322441074136.254200402822-1.07143670154653
81715599.305588164758-1.87207518228141107.3418356139240.704006055071197
82657629.63961206741-1.4281520279669613.18237119479941.19443422218725
83653639.615028048671-1.275934326201738.361108659598370.423087885211165
84642624.650954562691-1.4550425624590323.3801769942602-0.507818262702407
85643621.480329145757-1.4774415117903722.2751339716811-0.0636087685384157
86718635.388778069596-1.2734000465051675.84496149386980.569813235567022
87654655.976837804265-0.97553666369995-11.57397560141580.80851384281048
88632624.298641517965-1.4060918681453521.1587647339096-1.13425862673243
89731612.050837209052-1.56152856199170123.697585528878-0.400387398236031
90392609.826912515841-1.57112542773569-217.536734987818-0.0244731298740309
91344610.519622101672-1.53840237875069-267.5123001973050.0837185905122837
92792630.867041236609-1.22625500767058151.5240730718990.810194216984395
93852676.749855698353-0.568159785211801154.5429341845001.74542190475153
94649674.149377770956-0.595899610253425-24.2552797243459-0.0753408918796882
95629654.52758315293-0.850391654729315-17.1531932033344-0.705501806771062
96685653.712202098903-0.84992911902164631.27238641385280.00129817759552111
97617638.409682026268-1.04055275350547-15.0500601187458-0.535692805971087
98715636.419770257486-1.0531857703237978.997646976741-0.035164371491228
99715656.862829514019-0.76257603445343948.69538025794990.795577263933655
100629643.810657405746-0.931642481550809-9.4176764466217-0.454545437421962
101916688.768023886694-0.291480656918096207.1044699486071.69686083789203
102531720.2279131641010.154615745349867-203.1556683036371.17434988968461
103357704.737612000818-0.0649873767470255-340.871211899862-0.578952297308622
104917728.9073089838210.272434359994997177.4482326408910.897390366024121
105828714.2623742732520.0674211954527441120.294529985932-0.552679284685347
106708712.7914172767770.0465858003787882-4.11484250426232-0.0570172389326116
107858762.2424044712110.70723645952917274.02250708959431.83141410520292
108775764.7487605589540.7311063396096649.459681887003720.0666915443393308
109785778.8563769389140.9083442295049440.2596800392945480.49573786647434
1101006833.8051703848981.62796873335074148.4353284231412.00193181356576
111789819.1258530076791.40878172503416-22.9605532293672-0.60381381317988
112734804.9805576549641.19750128286981-64.1499726398601-0.5757023262697
113906775.4310017967470.776192668393245144.067515816919-1.13786546360258
114532756.1910262411270.500642625919868-215.403299092785-0.740830848502529
115387748.1832488883480.383549058208852-357.446617512852-0.315009315688191
116991766.2587409229550.625836602479941216.9679424139590.655265634842063
117841760.6375602794320.54097214436416783.108465096877-0.231454166914231
118892813.2391124158171.2417574911098355.86803073970571.92933611495761
119782794.6386415974450.976797113598297-3.91141493290453-0.735431409482744
120813800.4336460834261.0408126894132910.44705883952890.178580028311706
121793807.715363792311.12364257364201-17.46007203074460.231277606022705
122978810.3460927592791.14370088782955166.9912899105760.0558363090836428
123775800.9800445939061.00305255874989-21.3609316892798-0.389265791214877
124797810.5429883291921.11833942004229-17.30388110694070.316972230061722
125946806.4846302768681.04824142081894141.789387714637-0.191673987913987
126594807.4957234915261.04773688685236-213.479404920941-0.00137554507840970
127438809.1692795088381.05623603275497-371.4442406139270.0231774436329254
1281022811.4322067125181.07257568478584210.0374719821150.0447007517877364
129868813.0228003520971.0795552855137154.74947329989910.0191936889291054
130795787.5313453053110.72358596765035419.1523093908025-0.98467096989025
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/1690z1293536993.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/1690z1293536993.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/2690z1293536993.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/2690z1293536993.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/3ziik1293536993.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/3ziik1293536993.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/4a9zn1293536993.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/4a9zn1293536993.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/5a9zn1293536993.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/28/t1293536908i1g8zjvaur187cd/5a9zn1293536993.ps (open in new window)


 
Parameters (Session):
par1 = 12 ;
 
Parameters (R input):
par1 = 12 ;
 
R code (references can be found in the software module):
par1 <- as.numeric(par1)
nx <- length(x)
x <- ts(x,frequency=par1)
m <- StructTS(x,type='BSM')
m$coef
m$fitted
m$resid
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
bitmap(file='test2.png')
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()
bitmap(file='test3.png')
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()
bitmap(file='test4.png')
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()
bitmap(file='test1.png')
plot(as.numeric(m$resid),main='Standardized Residuals',ylab='Residuals',xlab='time',type='b')
grid()
dev.off()
bitmap(file='test5.png')
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()
load(file='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='mytable.tab')
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by