Home » date » 2009 » Dec » 02 »

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: Wed, 02 Dec 2009 09:07:15 -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/02/t125977012155k41kcayq9tyrl.htm/, Retrieved Wed, 02 Dec 2009 17:08:48 +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/02/t125977012155k41kcayq9tyrl.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 «
108.5 112.3 116.6 115.5 120.1 132.9 128.1 129.3 132.5 131 124.9 120.8 122 122.1 127.4 135.2 137.3 135 136 138.4 134.7 138.4 133.9 133.6 141.2 151.8 155.4 156.6 161.6 160.7 156 159.5 168.7 169.9 169.9 185.9 190.8 195.8 211.9 227.1 251.3 256.7 251.9 251.2 270.3 267.2 243 229.9 187.2 178.2 175.2 192.4 187 184 194.1 212.7 217.5 200.5 205.9 196.5 206.3
 
Output produced by software:


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


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
1108.5108.5000
2112.3112.1079905670520.2995203334646320.192009432947680.234351320027692
3116.6116.4090300790650.8876148522163260.1909699209353220.406095837952912
4115.5115.3086125150950.5069708313361370.191387484905296-0.196432614080234
5120.1119.9092835733741.405745947684840.1907164266257170.397420833309356
6132.9132.7107102053204.098451498067860.1892897946798541.09442172247909
7128.1127.9098700954531.909807170824710.190129904547208-0.849289434139052
8129.3129.1098199290101.731363425648710.19018007098989-0.067500890602942
9132.5132.3098973170132.105033799615360.1901026829873610.139380176174126
10131130.8097560069551.181722123955560.190243993044685-0.341747259421099
11124.9124.709543947020-0.6900295379207450.190456052980489-0.689855260765352
12120.8120.609470218456-1.56830580031740.190529781543639-0.322941913658471
13122122.651708053429-0.67070203984092-0.6517080534287920.39704415205166
14122.1122.039447201094-0.6563362883318720.06055279890584660.00463021949165108
15127.4127.3463710666690.8850329133205070.05362893333130290.563633530939744
16135.2135.1523313001442.672646662157250.04766869985591810.654463099242995
17137.3137.2519652436142.524692902789280.0480347563857951-0.0542031281548969
18135134.9496777167851.278530899634870.0503222832147156-0.456699678648379
19136135.9495797608491.206601865508260.0504202391509342-0.0263661848720782
20138.4138.3498910885491.514761314550730.05010891145148250.112970838502852
21134.7134.6488819526140.1682743108602720.0511180473862879-0.49365021666894
22138.4138.3493889308551.080164129837500.05061106914502230.334328967300456
23133.9133.848794722423-0.3606089709485420.0512052775769712-0.528244758194134
24133.6133.548799510041-0.3449601437175950.05120048995856390.00573754075203173
25141.2140.4081610175661.487023683511260.791838982434040.736730848354184
26151.8151.7306511664203.946725630812490.06934883358023980.837608783247037
27155.4155.33038329553.857040997817830.0696167044999834-0.0328123753762335
28156.6156.5288611333093.170329548113920.0711388666909328-0.251484976370749
29161.6161.5296385331263.642994027162780.07036146687420370.173189197355598
30160.7160.6282068063022.469679551064390.0717931936984147-0.430040013420672
31156155.9265307645340.6182266407125350.073469235465853-0.67869832266883
32159.5159.4270304806741.362341701488780.07296951932550080.272798850669425
33168.7168.6280386525963.386053340679040.07196134740405450.741945776264576
34169.9169.8278300608182.821619334945020.0721699391821734-0.206941845093007
35169.9169.8276303392772.09309276093120.0723696607226506-0.267108022297403
36185.9185.8283605498855.683754871782610.07163945011506071.31649613388155
37190.8191.5797244185135.70103908380125-0.7797244185132520.00674254824636057
38195.8195.7453834039165.313802871644020.054616596083769-0.134786750952614
39211.9211.8515554686468.102463971560120.04844453135357281.02083549291497
40227.1227.0545674363219.936344293339010.04543256367897570.67180158286185
41251.3251.25905699883813.62059306221580.04094300116244721.35017346216786
42256.7256.65713773517611.49763556602790.0428622648238606-0.778172340319613
43251.9251.8543152626467.289218675156890.0456847373538225-1.54278319793577
44251.2251.1532889220945.226337319742110.0467110779061335-0.756290805500648
45270.3270.2546110242328.808520170455130.04538897576800561.31334238926104
46267.2267.1537692009725.733789466096520.0462307990276661-1.12731660280892
47243242.952199505244-1.994919499280630.0478004947564810-2.83367806576953
48229.9229.851767521988-4.862164109195090.0482324780116287-1.05126185453105
49187.2190.846821033877-13.6130873322921-3.64682103387687-3.36178761805418
50178.2177.863188963842-13.45355006466300.3368110361578230.0561944119767591
51175.2174.867937333590-10.75164420188820.3320626664103220.989400902380608
52192.4192.077353771140-3.530530771425930.3226462288598262.64577173900073
53187186.676886637842-4.013366926614870.323113362157837-0.176963386407946
54184183.677074463347-3.751678380998180.3229255366532520.0959274445987369
55194.1193.778978905259-0.1749541468331040.3210210947413231.31124736495429
56212.7212.3808937272234.672823836170230.3191062727773861.77731521856663
57217.5217.1809033487304.705660496496990.3190966512703500.0120390754466365
58200.5200.179685200108-0.8986275033943730.320314799892371-2.0547615681818
59205.9205.5799474191360.7276331769556650.3200525808639280.596258950010388
60196.5196.179634654342-1.887238836331220.320365345657877-0.958732070721639
61206.3208.7729035833461.82976239899704-2.472903583346231.41479136733123
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/1lnwi1259770033.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/1lnwi1259770033.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/2ipud1259770033.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/2ipud1259770033.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/3gx4x1259770033.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/3gx4x1259770033.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/4dcg41259770033.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/4dcg41259770033.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/5jptt1259770033.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t125977012155k41kcayq9tyrl/5jptt1259770033.ps (open in new window)


 
Parameters (Session):
par1 = 12 ; par2 = periodic ; par3 = 0 ; par5 = 1 ; par7 = 1 ; par8 = FALSE ;
 
Parameters (R input):
par1 = 12 ; par2 = periodic ; par3 = 0 ; par5 = 1 ; par7 = 1 ; par8 = FALSE ;
 
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