Home » date » 2010 » Dec » 29 »

Paper: 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, 29 Dec 2010 16:22:57 +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/29/t12936396535ulimsjzv1iy152.htm/, Retrieved Wed, 29 Dec 2010 17:20:58 +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/29/t12936396535ulimsjzv1iy152.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 «
31245 30951 30872 30752 30967 30781 30681 31356 31434 31594 31949 32396 32441 32447 32288 32418 32346 32091 31855 31683 31615 31840 31536 31383 31638 31626 31720 31472 31372 31419 31341 31171 31036 30532 30666 30571 30173 30032 29874 30018 29911 29963 30050 29901 29544 29451 29293 29334 29389 29563
 
Output produced by software:


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Gwilym Jenkins' @ www.wessa.org


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
13124531245000
23095130966.2739415637-15.5442801599388-15.2739415637431-0.791661176826256
33087230887.5166084096-16.1346586769645-15.5166084096155-0.29892365905723
43075230767.9090426388-17.380907596485-15.9090426388181-0.48861711586687
53096730982.0438767587-13.9829549850008-15.04387675869471.09174463019894
63078130796.6733130974-16.9353257897189-15.6733130973929-0.807107610329334
73068130696.9712984209-18.5643540818563-15.9712984208925-0.389255466828759
83135631369.5378493448-3.33426269602627-13.53784934483123.24626914594959
93143431447.2593847371-1.36600264825519-13.25938473707210.380253557263629
103159431606.72146059022.88249691480855-12.72146059024340.75359423887647
113194931960.580922145912.8623013850883-11.58092214593091.64271996943008
123239632406.217236970325.9905886651772-10.21723697027922.02338682077191
133244132361.243222037826.305722557765679.7567779622374-0.398149163354623
143244732452.697054523629.5342130970008-5.697054523570420.258805926359441
153228832293.939576966523.1125477764634-5.93957696650549-0.876969086273123
163241832423.806975614926.9164976769195-5.806975614865730.496794993291035
173234632351.925147224423.2559089050994-5.92514722443949-0.459409099559962
183209132097.244829950412.5930008502601-6.24482995041355-1.29145369042109
193185531861.5191425292.76515580695383-6.51914252899029-1.15305278087372
203168331689.7041494154-4.33937976419046-6.70414941536826-0.810144006477588
213161531621.7687318731-6.99273965837496-6.76873187306778-0.294948002278496
223184031846.54341113152.8954429917442-6.543411131536771.07432379848715
233153631542.8285184522-10.4503339895168-6.82851845221873-1.42054592977705
243138331389.9550843462-16.7618423480564-6.95508434620576-0.659556110132069
253163831527.8345327213-11.4293162628538110.1654672787040.785401175030913
263162631634.2436891432-5.28026573408549-8.243689143225130.497025632650487
273172031728.197021138-0.702650629023177-8.197021137960540.458914510848177
283147231480.3078370393-12.2426509901965-8.30783703927386-1.14277732721684
293137231380.3453068556-16.3821604570421-8.3453068555836-0.405424961254062
303141931427.3195334722-13.3633544754091-8.319533472162640.292744987250647
313134131349.3445541952-16.4687894514474-8.34455419519239-0.298473926864508
323117131179.4011080844-23.902955353664-8.40110808439705-0.70882384263698
333103631044.440035665-29.3202906414276-8.44003566500355-0.512821616280683
343053230540.5981982787-52.6131252897033-8.59819827865321-2.19075626401384
353066630674.539087559-43.4038667268277-8.539087558982930.861136304245901
363057130579.5546202609-45.9631068661237-8.55462026087105-0.238061582436233
373017330136.4336583547-64.20975131951236.5663416453475-1.95087065774321
383003230035.7235296431-66.1318608577058-3.72352964305939-0.157954438992422
392987429877.7386827749-70.7431144549682-3.73868277487997-0.423742064582086
403001830021.7050470175-59.9278244707317-3.705047017548250.990414823373518
412991129914.7120475897-62.3057582247592-3.71204758971698-0.217083686027672
422996329966.6959091468-56.5156469474721-3.695909146797060.527107870954779
433005030053.6766755633-49.2280954675697-3.676675563319550.66176262275603
442990129904.6893662596-54.3055566941981-3.68936625955319-0.460029459230713
452954429547.7259048464-69.740394105798-3.72590484639961-1.39559295784481
462945129454.7285691163-70.9285469124179-3.7285691163369-0.107234838963537
472929329296.7380324213-75.3834673424578-3.7380324213163-0.401412269638809
482933429337.7260314656-69.4202663517712-3.726031465557020.536524188056835
492938929340.1757307954-65.848963775022548.82426920455780.347375103767396
502956329564.9375212838-50.615856627008-1.937521283812241.27568802192432
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/1d08k1293639774.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/1d08k1293639774.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/2d08k1293639774.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/2d08k1293639774.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/3o9q51293639774.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/3o9q51293639774.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/4z0p81293639774.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t12936396535ulimsjzv1iy152/4z0p81293639774.ps (open in new window)


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