Home » date » 2010 » Dec » 12 »

Structural Time Series Model

*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: Sun, 12 Dec 2010 11:13:33 +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/12/t1292152306amqrfwabfwii01l.htm/, Retrieved Sun, 12 Dec 2010 12:11:47 +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/12/t1292152306amqrfwabfwii01l.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 «
43880 43110 44496 44164 40399 36763 37903 35532 35533 32110 33374 35462 33508 36080 34560 38737 38144 37594 36424 36843 37246 38661 40454 44928 48441 48140 45998 47369 49554 47510 44873 45344 42413 36912 43452 42142 44382 43636 44167 44423 42868 43908 42013 38846 35087 33026 34646 37135 37985 43121 43722 43630 42234 39351 39327 35704 30466 28155 29257 29998 32529 34787 33855 34556 31348 30805 28353 24514 21106 21346 23335 24379 26290 30084 29429 30632 27349 27264 27474 24482 21453 18788 19282 19713 21917 23812 23785 24696 24562 23580 24939 23899 21454 19761 19815 20780 23462 25005 24725 26198 27543 26471 26558 25317 22896 22248 23406 25073 27691 30599 31948 32946 34012 32936 32974 30951 29812 29010 31068 32447 34844 35676 35387 36488 35652 33488 32914 29781 27951
 
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'RServer@AstonUniversity' @ vre.aston.ac.uk


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
14388043880000
24311043150.605395067-39.9885351105205-40.6053950670326-0.20852402299267
34449644522.5614999474-33.7746155184083-26.56149994737430.673368446250687
44416444202.4968507214-34.9035189651365-38.4968507213675-0.136524520045107
54039940465.8225010153-49.7091507760095-66.8225010152794-1.76526639674614
63676336838.0864402425-63.9669103376996-75.0864402424535-1.70624325280129
73790337951.0464316386-59.2958173139072-48.04643163856050.561233306690417
83553235612.9812881593-68.3042423389612-80.9812881593276-1.08665314025625
93553335597.2403857035-68.0972672846299-64.24038570347630.0250651426966414
103211032206.9758129331-81.1274294164487-96.975812933147-1.58418322163715
113337433438.5106847061-75.999036637909-64.51068470613580.625941330412249
123546235521.4303590032-67.5972599542006-59.43035900315261.02946986468049
133350833624.02961902499.66214467349127-116.02961902486-1.05286658160909
143608036009.008705753966.7883697704570.99129424607660.965075795919313
153456034512.357785194163.089493169207747.6422148058947-0.744803224277266
163873738615.823001919270.2195997562275121.1769980808271.92468507774897
173814438091.339107315569.118801014114752.6608926845258-0.283293720983083
183759437550.151362097967.988808222382543.8486379020716-0.290726007552036
193642436346.277290467965.638674108784577.7227095320709-0.605864387718659
203684336787.275896475666.33097251254455.72410352444770.17880609340182
213724637155.789954966466.887266482368190.2100450335610.143947394167836
223866138598.412708326769.415937594369662.58729167332410.65534210630465
234045440370.015229412472.593390878509383.98477058758790.810874597130249
244492844797.791279033879.8425923348354130.2087209661792.07435208101388
254844148543.55557208958.69371201338716-102.5555720894651.91967290216639
264814048114.86020196782.0141846625213325.1397980321874-0.189665683708347
274599846084.2743934669-1.79189132749744-86.2743934668697-0.967958959675665
284736947289.4227623402-0.43468629529080179.57723765982280.574763396273965
294955449540.7468886662.3186932883054713.2531113340261.07231693887742
304751047558.5900654494-0.12268872165468-48.5900654493779-0.945032950914257
314487344894.4310686369-3.39470363187884-21.4310686368649-1.26864777629044
324534445337.9175686686-2.846553528788086.082431331416980.212810319805221
334241342444.6398155746-6.38709224802698-31.6398155745698-1.37645755370533
343691236995.8877821125-13.0589191238438-83.8877821124658-2.59172255467716
354345243365.3980508526-4.884507730458686.6019491473583.03963836510197
364214242168.6429699975-5.96336334932616-26.6429699975158-0.567453346572999
374438244053.1805329242-29.4611513303735328.8194670757480.95790209795342
384363643615.6981923538-33.982535227211620.3018076462236-0.1819833779395
394416744280.4027212283-32.7943517061009-113.4027212283150.33264999099161
404442344415.8262405269-32.65531895402147.173759473065270.0800965619439486
414286842902.3498075826-34.0246718346821-34.3498075826154-0.705083753628604
424390843925.4634112581-33.0311323216479-17.46341125811260.50334990782691
434201342121.7504662053-34.6928662973513-108.750466205296-0.843099119239537
443884638903.3079684338-37.6770285755032-57.3079684338249-1.51592183008409
453508735101.6515730261-41.2003307706442-14.6515730260998-1.79219293890193
463302633240.5434521689-42.9139328633428-214.543452168869-0.866541351970414
473464634540.1603236547-41.555124468957105.8396763452510.639291292466516
483713537173.7114849794-40.260108811871-38.71148497943791.2733608932166
493798537509.4320665908-43.6463793264382475.5679334091620.18728434355937
504312143000.03148791424.00616921374278120.9685120857592.50791551629797
514372243817.88833902335.33934573009184-95.88833902325490.387400713078199
524363043566.66517799125.169050542892463.3348220087785-0.122152320834906
534223442284.0905329054.20224862367967-50.0905329049819-0.61310052346085
543935139373.37810690731.94504044218366-22.3781069072475-1.38780403622646
553932739345.51685137811.92197598673168-18.5168513780562-0.0141909143108158
563570435742.829631409-0.863013673624177-38.8296314089763-1.71617024831205
573046630491.8932567225-4.91401387680109-25.893256722501-2.49958084699912
582815528351.4290056913-6.58649106931663-196.42900569126-1.0167553597024
592925729120.5041406137-5.92039239844198136.495859386350.369333907029543
602999829989.1806366894-5.743234891549728.81936331064040.416265155046371
613252932322.6924607203-22.0099360051456206.3075392796761.15300671784623
623478734652.3360546795-5.61245498170971134.6639453205521.07670691692228
633385534001.6237243225-6.6564237049504-146.623724322551-0.307010646939843
643455634479.8790281753-6.379870398178476.1209718246530.230861945688873
653134831428.867649274-8.31798439239332-80.8676492739637-1.44948733175169
663080530853.8829646202-8.69688969763075-48.8829646202055-0.269778388511193
672835328394.4478181908-10.3376355282636-41.447818190811-1.16674675890099
682451424543.1925775543-12.9035482997543-29.1925775542935-1.82858207004017
692110621145.3946855441-15.1630162962173-39.3946855440835-1.61147782302607
702134621524.2737006605-14.8926387100177-178.273700660480.187598678438295
712333523170.5172568165-13.6358480329782164.4827431835420.790923272651521
722437924393.2729629335-13.638541892004-14.27296293347920.588433725203758
732629026095.6908395077-23.2075346128415194.309160492270.839757571404564
743008429855.9521490642-1.24824900393686228.047850935781.74483398169535
752942929634.9075194692-1.60304286342051-205.907519469192-0.104581776063354
763063230464.3167949132-1.17275101309629167.6832050868350.395627623781772
772734927514.0998927524-2.8122454678773-165.099892752418-1.40393133725234
782726427262.1509408089-2.960628260263991.84905919109212-0.118604614046259
792747427429.9581887566-2.8584204607074344.04181124337140.0812962206419516
802448224498.4488485732-4.60621786486692-16.4488485731768-1.39422075894487
812145321537.6891682898-6.37172912617584-84.6891682898468-1.40731396120478
821878819029.6975351837-7.93085941708913-241.697535183663-1.19095934051552
831928219101.0349653858-7.87698809793577180.965034614230.0377411159427243
841971319729.5531777541-7.97669007420436-16.55317775409590.302877906171253
852191721815.4773619145-17.573667334842101.5226380855111.01929251857023
862381223543.8382294741-8.9713102676991268.1617705259180.809502603783559
872378524040.8027051662-8.15493700590668-255.8027051661760.24067978432716
882469624454.5062014376-7.94766478499516241.4937985623630.200835510174121
892456224724.0060406921-7.80992398799741-162.0060406921420.132079362415062
902358023644.1120338016-8.39092040324117-64.1120338016488-0.510365753757969
912493924805.26495629-7.75045405591025133.7350437099520.55676192396322
922389923892.8480985152-8.244198962614246.15190148478202-0.43066662526235
932145421537.5394491615-9.52991941654673-83.5394491615492-1.11732233052469
941976120024.1197022448-10.4030512611947-263.119702244791-0.715953484840928
951981519633.7218121554-10.6370823696252181.278187844583-0.180917351185997
962078020801.9665027555-10.9609078302838-21.96650275549460.561079105237928
972346223312.149002099-20.6226660037555149.8509979010421.22239034010949
982500524724.834942946-14.5380457564055280.1650570539970.667295205069921
992472525005.1745326512-14.063028817202-280.1745326511830.140248102730746
1002619825950.7539601934-13.60042887527247.2460398066290.456857682547373
1012754327630.392113416-12.835901008356-87.39211341597110.806055499478176
1022647126627.110485057-13.3316895383551-156.110485057029-0.471492786008999
1032655826423.2801194342-13.4287503774796134.719880565789-0.0906852376340076
1042531725292.898658397-13.996044959426424.1013416029927-0.531715325686414
1052289623003.887149622-15.1611024343511-107.887149622037-1.08300482638442
1062224822489.6742141607-15.4357465923667-241.674214160664-0.237580402894759
1072340623213.655552575-15.0219334235474192.3444474250190.352029619867524
1082507325102.5016603975-15.7161582894693-29.50166039751520.906177118946348
1092769127495.9780489627-23.5323474734794195.0219510373021.16447843985375
1103059930256.832699795-13.2281608415219342.1673002050261.30052495881472
1113194832205.6957249483-10.0814924480439-257.6957249483220.933017691264404
1123294632753.6274157977-9.81131861254138192.3725842022640.265653336911307
1133401234036.8463963579-9.27176594649073-24.84639635790720.61553156872512
1143293633134.1528708394-9.68937614100426-198.152870839364-0.42529921146062
1153297432823.4801602476-9.8338114383649150.519839752423-0.143278345118783
1163095130915.0376389712-10.743219799916935.9623610287586-0.9038022716704
1172981229908.8218678336-11.2269180253439-96.82186783365-0.473881916960275
1182901029260.9814842892-11.5628820831968-250.981484289156-0.303067104814339
1193106830847.4960773496-10.7508446625621220.5039226504080.76080666642089
1203244732490.2834565786-11.4656476141887-43.28345657864040.787078969697979
1213484434707.428519598-17.6437218061087136.5714804020451.07451999197507
1223567635384.7727420338-15.3800025078235291.2272579662480.325462868965301
1233538735661.2872922101-14.915487155905-274.2872922100670.138777378608648
1243648836328.8887329862-14.5785271705022159.1112670138140.324925747189646
1253565235687.6083738839-14.8237469457719-35.6083738838575-0.298331460731018
1263348833757.2356475612-15.666712565389-269.23564756124-0.911856357912074
1273291432736.0528252838-16.1252816324323177.947174716173-0.478654248410551
1282978129806.0523014979-17.4553363658106-25.0523014978898-1.38708754230559
1292795128053.7135186009-18.2644990932645-102.713518600916-0.825862228789122
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/1vi2l1292152407.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/1vi2l1292152407.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/2nrjo1292152407.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/2nrjo1292152407.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/3yi091292152407.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/3yi091292152407.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/4yi091292152407.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/4yi091292152407.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/5yi091292152407.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/12/t1292152306amqrfwabfwii01l/5yi091292152407.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