Home » date » 2009 » Dec » 07 »

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: Mon, 07 Dec 2009 15:48:25 -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/07/t12602261623sm3szhvivf8hxx.htm/, Retrieved Mon, 07 Dec 2009 23:49:28 +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/07/t12602261623sm3szhvivf8hxx.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:
Structural Time Series Models
 
Dataseries X:
» Textbox « » Textfile « » CSV «
220206 220115 218444 214912 210705 209673 237041 242081 241878 242621 238545 240337 244752 244576 241572 240541 236089 236997 264579 270349 269645 267037 258113 262813 267413 267366 264777 258863 254844 254868 277267 285351 286602 283042 276687 277915 277128 277103 275037 270150 267140 264993 287259 291186 292300 288186 281477 282656 280190 280408 276836 275216 274352 271311 289802 290726 292300 278506 269826 265861 269034 264176 255198 253353 246057 235372 258556 260993 254663 250643 243422 247105 248541 245039 237080 237085 225554 226839 247934 248333 246969 245098 246263 255765 264319 268347 273046 273963 267430 271993 292710 295881 293299 288576
 
Output produced by software:


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


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
1220206220206000
2220115220151.947561343-57.105956069184-36.9475613429499-0.0241578908683742
3218444218884.832710419-825.237855151883-440.832710418858-0.257968044864550
4214912215807.635089226-2313.37718911019-895.6350892258-0.527721428071982
5210705211283.377214379-3774.90936620938-578.377214378565-0.479226635424588
6209673208881.96866542-2884.886369516791.0313345801440.293510621151455
7237041228413.50729120111674.11624824068627.492708799264.82514873367526
8242081243632.84489822713982.9247329545-1551.844898226550.763704401832559
9241878246732.2439687096892.89399700677-4854.24396870908-2.34470007420332
10242621244809.281166151150.94170799541-2188.28116614989-1.89908005699550
11238545239904.48547557-2792.34611975729-1359.48547556992-1.30415484917333
12240337238931.777842675-1607.583554731001405.222157324990.391831081100997
13244752242658.7198401581852.959619138642093.280159842471.14900380079447
14244576244677.8495821231961.25480932071-101.8495821234060.0364069440670138
15241572242094.817409794-924.33898095333-522.817409794261-0.945829032128195
16240541239259.420223356-2118.810994376881281.57977664350-0.40053041610154
17236089237147.009246986-2114.75867793284-1058.009246986400.00135060985011902
18236997242297.9250452592460.46145689813-5300.925045258741.50664286547255
19264579254795.2533541488746.131040220089783.746645852432.07748339526408
20270349267772.90530332711400.28634778102576.09469667280.87860459636238
21269645273762.9724327738001.5633362573-4117.97243277296-1.12407224299349
22267037270811.5887986171119.49118215211-3774.58879861729-2.27607867707033
23258113263028.443330783-4471.29014092542-4915.44333078321-1.84911114869343
24262813261672.552954001-2517.204506221561140.447045999200.646608876382176
25267413263694.834714795330.9981852313793718.165285204520.945007737571297
26267366265008.563021343948.4388606389962357.43697865690.204561220854836
27264777264104.939732210-206.068971212011672.060267789575-0.380643411426417
28258863258737.122490497-3404.43215604157125.877509502864-1.06137009388874
29254844257664.911934918-1952.28530881217-2820.9119349180.482682294448132
30254868262613.7821667262347.54295820549-7745.782166725991.42071120739347
31277267269030.0377056884873.295488964078236.962294312050.83397540008689
32285351279099.4297172258096.831403313576251.570282774791.06620121409361
33286602286654.9988949657760.65485853806-52.9988949654144-0.111202917135502
34283042286469.7543992012823.21138281052-3427.75439920139-1.63296438615244
35276687284431.267887248-196.634488030494-7744.26788724804-0.998871775327268
36277915280209.941286073-2695.76440348411-2294.94128607324-0.827219284042565
37277128274662.903502512-4467.682544714052465.09649748757-0.586966422333203
38277103272191.034043496-3227.636414032064911.96595650440.410087234379275
39275037270967.602949350-1987.373279350464069.397050649730.409571799619892
40270150270146.799993162-1267.411956889913.200006838248380.238446656662148
41267140271477.918684309339.845263588217-4337.918684309270.53310467720651
42264993274189.7630761741808.96867566131-9196.763076174050.486008904553596
43287259280282.3737594834457.470270698496976.626240517140.874882867546938
44291186285196.9748446354739.748207411935989.025155365270.0933112628916727
45292300289682.0998378514582.480683723112617.90016214859-0.0520160290744053
46288186291018.1321385962576.57305337064-2832.13213859644-0.663516900184109
47281477289001.116672355-261.713807785126-7524.11667235522-0.93904242071879
48282656284947.388112201-2605.23589926443-2291.38811220076-0.775685943000199
49280190279282.544137391-4497.20050282367907.45586260913-0.626181624029428
50280408275442.358122193-4091.178573530714965.641877806730.134220052351034
51276836272488.48132049-3390.094594606524347.518679510200.231660115571597
52275216274046.018825338-344.6045240954291169.981174661711.00804906563687
53274352278283.790377472479.59117482337-3931.790377469880.935797187822265
54271311282128.8621404933322.15763959838-10817.86214049310.278826417869663
55289802284067.2607956322468.995370789495734.73920436849-0.281959040822644
56290726285400.4259756541769.577909370265325.57402434617-0.231164278915934
57292300288233.1236118952423.962908628894066.876388104830.216402825998896
58278506282792.322991091-2417.77686281426-4286.3229910909-1.60175727125959
59269826276479.159996527-4816.5113818281-6653.15999652672-0.79377699727771
60265861267887.661453307-7142.15368993512-2026.66145330681-0.769699633530674
61269034265705.385787276-4085.541610843213328.614212723691.01121325919332
62264176260408.221499890-4831.668830450083767.77850010972-0.246629111376303
63255198253481.744716514-6119.423399651021716.25528348597-0.425634405871612
64253353252071.997462188-3226.829300777461281.002537812360.957208783067707
65246057250421.130360352-2258.0893904175-4364.130360352040.320827585888107
66235372246662.910193551-3181.1115861402-11290.9101935510-0.305468682572277
67258556250312.1265525451019.976643129308243.873447455341.38881791005744
68260993255167.5911805503376.416261964565825.408819450260.778828074810524
69254663250705.812578547-1435.798463825313957.18742145281-1.59121978123962
70250643251538.340040763-43.2226585710357-895.3400407629830.460719772320593
71243422249883.725968071-1032.87649947438-6461.72596807086-0.327525653689344
72247105250235.144316805-182.240937093511-3130.144316804890.281506885416021
73248541246019.043699973-2661.427900249072521.95630002731-0.820018267294366
74245039241029.604878746-4091.124377364754009.39512125386-0.472581702373198
75237080236849.355489554-4145.78554897385230.644510445671-0.0180695605610081
76237085235047.703499156-2708.996568793912037.296500843920.475399087899224
77225554230583.823851440-3785.29650494648-5029.82385143955-0.35634510597235
78226839237077.3585575412523.95829881631-10238.35855754062.08795128167729
79247934241031.9115832773401.915762452426902.088416723150.290288509152947
80248333240984.1690012941286.892241921287348.83099870631-0.699075647119443
81246969243287.3014139091909.453771502783681.698586091220.205848112758371
82245098245746.1456974832245.96768923106-648.1456974833180.111332515081609
83246263251809.7951642014585.36704998856-5546.795164200710.77424331249251
84255765257149.461872225047.84083996436-1384.461872220210.153040188435924
85264319261069.2582793054356.160080261553249.74172069465-0.228759466745436
86268347264329.9845132653684.963141417054017.01548673516-0.221869429510257
87273046271645.4572365625907.046188109271400.542763438170.734628693754829
88273963273610.2860322833495.28633470969352.713967717219-0.797932356444467
89267430276480.2961273083112.5612259563-9050.29612730787-0.126689952964128
90271993281671.6561361844385.83631050951-9678.656136183610.421347929455546
91292710284933.8448701953697.654355295597776.15512980473-0.227562193110791
92295881288619.798811853690.494316052927261.20118815018-0.00236675304644896
93293299290654.7198211552678.193928730282644.28017884468-0.334710134743844
94288576291400.8397184851497.06521423281-2824.83971848502-0.390756492252324
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/1kjsn1260226102.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/1kjsn1260226102.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/2us7m1260226102.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/2us7m1260226102.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/3amf21260226102.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/3amf21260226102.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/41f9b1260226102.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/07/t12602261623sm3szhvivf8hxx/41f9b1260226102.ps (open in new window)


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