Home » date » 2009 » Dec » 04 »

WS 9 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: Fri, 04 Dec 2009 07:23:59 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh.htm/, Retrieved Fri, 04 Dec 2009 15:25:24 +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/2009/Dec/04/t1259936717hpkxtpzjimk4ulh.htm/},
    year = {2009},
}
@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 = {2009},
    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 «
98,8 100,5 110,4 96,4 101,9 106,2 81 94,7 101 109,4 102,3 90,7 96,2 96,1 106 103,1 102 104,7 86 92,1 106,9 112,6 101,7 92 97,4 97 105,4 102,7 98,1 104,5 87,4 89,9 109,8 111,7 98,6 96,9 95,1 97 112,7 102,9 97,4 111,4 87,4 96,8 114,1 110,3 103,9 101,6 94,6 95,9 104,7 102,8 98,1 113,9 80,9 95,7 113,2 105,9 108,8 102,3 99 100,7 115,5 100,7 109,9 114,6 85,4 100,5 114,8 116,5 112,9 102 106 105,3 118,8 106,1 109,3 117,2 92,5 104,2 112,5 122,4 113,3 100 110,7 112,8 109,8 117,3 109,1 115,9 96 99,8 116,8 115,7 99,4 94,3
 
Output produced by software:


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


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
198.898.8000
2100.599.0098361764009-0.03919196494493011.490163823599110.388717178313888
3110.4103.5579386721950.2891175123964456.84206132780532.37894910697432
496.4102.9166161045240.204866863319226-6.51661610452434-0.453472455807471
5101.9102.4670317502710.148646019839951-0.567031750271342-0.389935500093396
6106.2103.3141541063810.1990167386170892.885845893619020.485265288551031
78198.1421630341768-0.107051973677707-17.1421630341768-4.03755497919976
894.795.2415616478735-0.232145392064929-0.541561647873479-2.17500001561392
910195.4144494351909-0.2173514459748065.585550564809140.320074983827219
10109.498.829318846847-0.10246554965938510.57068115315312.88736399319624
11102.3101.082184715780-0.03405458018410861.217815284220441.87555612160628
1290.799.5211029931645-0.0765164808777496-8.82110299316446-1.21573693447957
1396.298.4278335880762-0.0786365050015628-2.22783358807624-0.837114293790518
1496.197.6344558667332-0.0779097749925256-1.53445586673316-0.597327158208534
1510697.2148151878089-0.08170897635672558.78518481219112-0.271968943399785
16103.199.6618169891172-0.01882448958634353.438183010882791.88477326938139
17102100.6986164551630.01668708991826741.301383544836830.764909178644743
18104.7100.138930896851-0.004582686716128254.56106910314886-0.422243923205732
1986100.4261423593640.00592639577782337-14.42614235936440.219563317532909
2092.199.2041441317476-0.0341627032902864-7.10414413174765-0.947080104535874
21106.999.9994108213925-0.01078726888906246.900589178607490.650523709474136
22112.6100.9246747034240.011179872870973711.67532529657560.741231190687254
23101.7100.7420164872390.007513457368282280.957983512761186-0.154306910210952
2492100.4773575374090.00347865014955188-8.4773575374093-0.217427882668088
2597.4100.1993034460080.000152177320648185-2.79930344600771-0.225435315804073
269799.9893586502527-0.00221301989496133-2.98935865025267-0.167732327906410
27105.499.651326768601-0.006680468942725655.74867323139898-0.265059650259245
28102.799.5463226882764-0.008331143758389173.15367731172359-0.0764024285973884
2998.198.7266147144523-0.024716530736683-0.626614714452342-0.6233580183334
30104.598.7024140438546-0.02470494168734365.797585956145440.000395471388422841
3187.499.3706841150724-0.00862983931384387-11.97068411507230.534309673127569
3289.999.283120171661-0.0104047850297574-9.38312017166093-0.0614178309585382
33109.8100.2123339964730.009061797682844339.587666003526980.737438521284237
34111.7100.4108593267850.012545407469318811.28914067321500.149661901763741
3598.699.71589924770790.00123238558733513-1.11589924770786-0.561278537023017
3696.9100.6718935139540.0145715389641173-3.771893513954150.759306942950503
3795.1100.2771283882590.00937848982912856-5.17712838825894-0.325724349963536
389799.94658042597370.00518462919910609-2.94658042597369-0.270001948785785
39112.7101.3972657816720.023796481024138711.30273421832791.14338861161793
40102.9101.4691615657810.02446981324184111.430838434218950.0378481793485489
4197.4100.7839887910140.0136337196838558-3.38398879101382-0.556052023203621
42111.4101.8568060091540.03087580789336299.543193990845790.828606522996382
4387.4101.7697560446860.0288996685262079-14.3697560446857-0.0923682580025581
4496.8102.9506345834580.048045614227143-6.150634583457590.90515765807726
45114.1103.7625024627430.060223362990124610.33749753725740.602428981689017
46110.3102.9126041122120.04664775840926897.3873958877875-0.720272168885567
47103.9103.2469602820920.05061242712228860.653039717908380.228286603326934
48101.6103.8729532006170.0579596860053997-2.27295320061670.457284546526323
4994.6103.26984397760.0499844650346042-8.66984397760002-0.525669500923169
5095.9102.2873566038820.0378471829486033-6.38735660388211-0.820531912534926
51104.799.87837340793140.00890068473133824.82162659206855-1.94164489347105
52102.899.40901512170270.003075004834395613.39098487829731-0.378787462775978
5398.1100.0381013794860.0109906154563009-1.93810137948650.494996185223788
54113.9101.4541739495320.029328130090376512.44582605046761.11014924342745
5580.9100.7730683169390.0199016027302481-19.8730683169387-0.561470987021063
5695.7100.8171713531480.0202218476453798-5.117171353148110.0191492475154115
57113.2101.1739509955730.024579715518218712.02604900442720.266736234786609
58105.9100.6833208826830.01814888371954395.2166791173168-0.409016963290624
59108.8102.1219322817810.03510141187175046.678067718219071.12930723947157
60102.3102.8292891903370.0427747121393249-0.5292891903367520.534999421844736
6199103.7561831930880.0525091831587319-4.756183193088420.703946053253157
62100.7104.4660510323590.059591557389357-3.766051032358910.523373688636769
63115.5106.2464934753620.07802238167366289.25350652463781.369460830772
64100.7105.0498826921100.0642789463183618-4.3498826921101-1.01367015760388
65109.9106.3887118895830.07820309143017323.511288110416561.01297767969026
66114.6105.8280333521110.07113444051419598.77196664788895-0.507603384435839
6785.4105.589356044990.0676839168247103-20.1893560449899-0.246175581026117
68100.5105.6837690247530.0679807938960927-5.183769024752640.0212493259229752
69114.8105.2440763404350.06241408694737959.55592365956484-0.403900964636287
70116.5106.9669011159960.080235972686569.533098884004031.32213392324065
71112.9107.7746703249420.08784062008109595.125329675058390.579769434185688
72102107.1829981459590.080929299987709-5.18299814595898-0.541834657596631
73106108.0829999505450.0890638668738728-2.082999950545090.653363831570579
74105.3108.8927837056050.096099529042043-3.592783705604910.574983331025758
75118.8109.2362529563760.09849176828775129.563747043623980.197334193980319
76106.1109.8075916887910.103052877421846-3.707591688790770.377132033601843
77109.3108.9727465416740.09399076370445170.327253458326185-0.747902412160804
78117.2108.5537942481450.08902199113528148.64620575185526-0.408996736360124
7992.5109.4949635258610.097279416064863-16.99496352586090.679515249683659
80104.2110.0108019131170.101319218354531-5.810801913117460.333849764300692
81112.5108.9621248076630.09032054053098793.5378751923371-0.917612323072251
82122.4109.6600019217480.096051788401591512.73999807825240.485005688976279
83113.3109.6505116439250.09507285274807743.64948835607482-0.0842908545868984
84100108.8882172941430.0872611125754726-8.88821729414274-0.684995664189131
85110.7109.7100181277830.09384379291497240.9899818722173090.587025782419494
86112.8111.6482624606420.1101502535024441.151737539358111.47423888983122
87109.8109.6986857865730.09211565004811930.10131421342673-1.64645292240216
88117.3111.4708440302130.1067372864369535.829155969787381.34294879762472
89109.1111.5453438826230.106457692833247-2.44534388262266-0.0257687263146201
90115.9110.7384944748430.09855641802826945.1615055251569-0.73005761651245
9196110.9770323693690.0997636310885871-14.97703236936940.111904473912141
9299.8109.7105455150050.0880402166762467-9.91054551500455-1.09238868789963
93116.8110.2032822497170.0914866335741696.596717750282670.323649442445218
94115.7108.7234232106930.07823849546017696.97657678930742-1.25699249627229
9599.4105.2100533046810.0483135624866218-5.81005330468101-2.87387823368404
9694.3103.7664068061120.0360382604140943-9.46640680611158-1.19411146143459
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/1ldtc1259936634.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/1ldtc1259936634.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/2gn7a1259936634.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/2gn7a1259936634.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/323jp1259936634.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/323jp1259936634.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/4e9g01259936634.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/4e9g01259936634.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/5wofk1259936634.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259936717hpkxtpzjimk4ulh/5wofk1259936634.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