Home » date » 2008 » Oct » 04 »

R Software Module: rwasp_structuraltimeseries.wasp (opens new window with default values)
Title produced by software: Structural Time Series Models
Date of computation: Sat, 04 Oct 2008 09:48:31 -0600
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp.htm/, Retrieved Sat, 04 Oct 2008 15:49:21 +0000
 
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/2008/Oct/04/t1223135356f0qj1f6ujwaihnp.htm/},
    year = {2008},
}
@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 = {2008},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
 
Feedback Forum:

Post a new message
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
112 118 132 129 121 135 148 148 136 119 104 118 115 126 141 135 125 149 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162 146 166 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236 235 229 243 264 272 237 211 180 201 204 188 235 227 234 264 302 293 259 229 203 229 242 233 267 269 270 315 364 347 312 274 237 278 284 277 317 313 318 374 413 405 355 306 271 306 315 301 356 348 355 422 465 467 404 347 305 336 340 318 362 348 363 435 491 505 404 359 310 337 360 342 406 396 420 472 548 559 463 407 362 405 417 391 419 461 472 535 622 606 508 461 390 432
 
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
1112112000
2118116.6626606916904.773184596283041.337339308309620.424228086199752
3132130.36539435268611.08629363361001.634605647313520.529048182303492
4129132.2554038506034.19626456331728-3.25540385060326-0.555722248049461
5121123.494626313775-5.30231596474222-2.49462631377453-0.743105140735055
6135130.6817950958933.821358788845914.318204904107170.720130136037163
7148145.95414617546712.21060777781852.045853824533370.661413933726645
8148150.7954622478146.80932805948146-2.79546224781396-0.425692617357551
9136139.990520461711-6.09921661026012-3.99052046171122-1.01743382120828
10119120.957802644102-15.5758529609840-1.95780264410201-0.74692092578782
11104103.451987938252-16.98990789387380.548012061747831-0.111451576664862
12118111.3207249073451.224059680339056.679275092655181.43557121454608
13115116.0844083319483.81134582845608-1.084408331948030.204507755305892
14126126.6032926287728.7319365884726-0.603292628772440.393842491594286
15141136.8854290655529.82660252813274.114570934448360.0859104667516074
16135136.6235105140042.70264247456078-1.62351051400396-0.570082862016424
17125132.265782545980-2.30644388051520-7.26578254597955-0.394341927591658
18149144.7753179890598.125929600481164.22468201094140.820765499532419
19170165.12343464350816.7344098391624.876565356491690.678999374537504
20170172.0740601525189.8336802268846-2.07406015251791-0.543950566398601
21158162.374910366543-3.94679540271878-4.37491036654335-1.08607975752017
22133137.890543692836-18.4354258565791-4.89054369283645-1.14202127902442
23114118.554402323149-19.0706500950083-4.55440232314876-0.0500667859326556
24140126.410420293942-0.099167194182086913.58957970605811.49570940092124
25145144.55671357964312.75657160009700.4432864203570291.01622753913443
26150153.0598760691099.75587656104946-3.05987606910869-0.236842074457532
27178168.05458049902313.41224601060209.945419500976710.287576582038791
28163166.1793490525382.7649581275039-3.17934905253831-0.843936935620426
29172180.70190758405710.9918316369533-8.70190758405670.649400425742288
30178182.6632713193584.6935147415959-4.66327131935787-0.495508878745891
31199191.572781419597.629133075401387.427218580410140.231380018841154
32199196.3071861958585.611372050245722.69281380414224-0.159076903408224
33184184.834370093571-6.30429066555181-0.834370093570528-0.939119855795826
34162167.362943995208-14.0929320047736-5.36294399520783-0.613904700032994
35146156.883810085996-11.5736790674629-10.88381008599590.198561325639064
36166155.255957151512-4.6447545837140910.7440428484880.546454103398629
37171165.8133893428825.953570484645365.186610657118350.836837132976558
38180181.91967042639413.0291186308284-1.919670426393770.557592856762758
39193182.26681969314.2362944099093310.7331803068998-0.692294781261979
40181187.0904729148894.64303253356208-6.090472914889340.0321419756069182
41183190.4104740511143.72421790724361-7.41047405111367-0.0725304779171351
42218218.89963516281420.9062887208813-0.8996351628138561.35283018921955
43230227.04113586192412.06476080837392.95886413807611-0.696554742432787
44242234.3416113882508.763581439334287.65838861174972-0.260227676805031
45209213.332056274183-11.8793694296199-4.33205627418256-1.62704133492129
46191196.521087801742-15.2988629756126-5.52108780174161-0.269515363128452
47172184.659553690482-12.9163867653801-12.65955369048200.187794396779592
48194184.923152430883-3.782829792971159.07684756911660.720342307591761
49196191.2187411276763.205631759519974.781258872323550.551346831741857
50196193.5793652590382.620114721496452.42063474096171-0.0461303970581764
51236218.30713202398917.892638556152517.69286797601101.20301536113992
52235241.22949540066021.3648406886763-6.229495400659560.274070218067409
53229249.14233068163512.0615504044849-20.1423306816346-0.734159647320932
54243245.7060599270011.34448644009747-2.70605992700094-0.844275931148752
55264257.0652610395438.261259511583936.93473896045710.544865112870836
56272257.4232427304122.8034225312237314.5767572695879-0.43015892390721
57237242.918319258182-9.15456064971263-5.91831925818191-0.94252759566146
58211219.717621625822-18.8597752100944-8.71762162582235-0.764957959581674
59180196.554402039715-21.8326820643722-16.5544020397148-0.234354717964244
60201189.55240002195-11.586515553310111.44759997804990.808018098314225
61204194.8947755653880.1139696152006979.105224434611570.922657384428048
62188193.968010150852-0.604799912117812-5.96801015085155-0.0566275735662766
63235213.76982320261213.461016748603221.23017679738801.10820943958349
64227229.31824504086914.8991855099870-2.318245040868530.113458600990099
65234249.22776638320918.3554252901921-15.22776638320880.272673321881451
66264270.88271086388420.6319762095977-6.882710863884030.179400007995152
67302293.37361175348421.91345394669648.626388246515770.100953005732385
68293281.873202730244-1.1123282134424811.1267972697561-1.8145502678856
69259262.838544116705-13.4650232241664-3.83854411670498-0.973630087449214
70229237.991720930741-21.3106154779756-8.99172093074134-0.618420447816356
71203221.812544436748-17.7735208045157-18.81254443674800.278850456827907
72229217.879015788159-8.2316577292182211.12098421184100.752399959898769
73242227.4849774672184.0691592866917214.51502253278170.969739544912286
74233242.2507601082811.4403317596786-9.250760108280260.58074584071076
75267248.0626397416477.5670766383599718.9373602583535-0.305200329098015
76269270.03104266919517.4745675341887-1.031042669195260.781397709791298
77270289.24435928499618.6718156799502-19.24435928499580.0944370993586474
78315320.69100738146627.4708742961284-5.691007381466410.693514204827846
79364346.45823089941526.298146928260617.5417691005849-0.0923937609037124
80347338.399552855432.659738936993698.60044714456973-1.86269968219959
81312316.241246632445-14.4152506868322-4.24124663244464-1.34581034369973
82274286.808838871045-24.7480933065974-12.8088388710448-0.814522126106674
83237259.835954062096-26.2790736812592-22.8359540620962-0.120702775949619
84278264.010296413837-5.3172980143488613.98970358616261.65275188387347
85284269.6683715114822.2380933250678914.33162848851840.595542863951897
86277281.2219020385098.64661735469492-4.221902038508940.504919188762609
87317299.7337164813815.426294230241817.26628351862030.534254380124766
88313316.16495270753016.1167838351696-3.164952707530410.0544499610015525
89318341.78780751170422.6527974427061-23.78780751170420.515484762668069
90374378.08121855960832.0346741376012-4.081218559608110.739517347738673
91413390.98170845451618.880143423142422.0182915454843-1.03646640590510
92405391.7169594116146.4123128808481313.2830405883859-0.982429961873201
93355361.647517720765-18.6508146892272-6.64751772076515-1.97537635871987
94306321.631712042152-33.3295988574643-15.6317120421517-1.15715376903353
95271299.208981707365-25.8346023907585-28.20898170736480.590925951624364
96306290.64764044357-13.96150044796915.35235955642990.936088813010688
97315297.7002648028950.4832661625217817.29973519710501.13849103385478
98301305.7669958822325.69289545501063-4.766995882232490.410472518613986
99356333.32214237815020.699353289372422.67785762185051.18259471303406
100348356.38350159606822.3204232115920-8.383501596067960.127820386265803
101355384.08800970358626.0176013563085-29.08800970358590.291563732161444
102422420.36272523054533.06331383520491.637274769455340.555397411729986
103465441.58241147324524.93046801601523.4175885267550-0.640839883200141
104467445.92330317254610.799392999861221.0766968274542-1.11347787699150
105404413.091335433132-19.1376659072242-9.09133543313218-2.35948271288976
106347369.497691262088-35.9184597133551-22.4976912620879-1.3228902128677
107305336.359426601366-34.0103331571782-31.35942660136570.150444180006701
108336321.234328622989-21.045330395928414.76567137701071.02212984780482
109340319.887574725373-7.5223809860776620.11242527462751.06578525542172
110318325.7850991104141.68521451513084-7.785099110413680.725496573538331
111362337.5925402465678.6255536277857324.40745975343270.546953694865871
112348357.24023306367716.1821123723225-9.24023306367690.595791749544721
113363393.31081129661229.8234812288097-30.31081129661161.07570034917776
114435431.3385075423335.45243320799763.661492457669890.443727044160513
115491463.21577190069833.000111948118127.7842280993017-0.193243447012732
116505474.71641867551418.260507884075430.2835813244859-1.16143083595589
117404421.551173575707-30.6917992519578-17.5511735757070-3.85812331339108
118359381.0457121019-37.4178140405408-22.0457121018997-0.530241025756103
119310346.097530112688-35.7247511120793-36.09753011268800.133488015392727
120337323.990935446682-26.386319161494513.00906455331770.736195483278567
121360333.613484522858-1.6953703212717526.38651547714231.94591938266177
122342348.3404605693019.55953664848347-6.340460569300910.886832445437818
123406379.53557390664524.378830011116326.46442609335471.16789994876742
124396411.73508281590729.7351664157374-15.73508281590680.42229734336832
125420453.44029188307837.9365978268413-33.44029188307770.646695219443857
126472475.78185311288927.2483811536401-3.78185311288862-0.842552142031253
127548510.95589493257232.679216165650137.04410506742770.427965982651617
128559513.66329012498312.151851454238645.3367098750172-1.61750229648595
129463484.876511647302-15.8768915175123-21.8765116473020-2.20904065954715
130407434.840687327804-39.2639975055724-27.840687327804-1.84370692817548
131362399.140219829521-36.823551151927-37.14021982952130.192413435082963
132405394.181742876809-14.995579886031210.81825712319101.72076552880008
133417392.714812664306-5.7290279492864824.28518733569440.730297475720311
134391400.3771849828383.43918739344151-9.377184982838010.722427022463098
135419397.703336344454-0.74393620833315321.2966636555464-0.329674040463495
136461463.86396108565245.0355881792500-2.863961085652193.60916421644799
137472506.97375433660243.7174067779917-34.9737543366021-0.103936003450084
138535544.91609156208539.7633943883813-9.91609156208539-0.311694512047514
139622578.09507850860935.256002858949643.9049214913912-0.355205283736055
140606560.043255317931-1.2195623253635145.9567446820694-2.87421682824557
141508524.076188293942-24.9870461521075-16.0761882939421-1.87319018376299
142461490.500756534984-30.8615124926861-29.5007565349837-0.463106532155359
143390441.01123096876-43.6064594764187-51.0112309687604-1.00484347008706
144432417.850761362678-29.614351497825814.14923863732221.10301852196438
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/1q8v81223135307.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/1q8v81223135307.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/20bja1223135307.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/20bja1223135307.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/35b681223135307.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/35b681223135307.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/411j61223135307.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/411j61223135307.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/5gb8j1223135307.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Oct/04/t1223135356f0qj1f6ujwaihnp/5gb8j1223135307.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