Home » date » 2009 » Dec » 03 »

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: Thu, 03 Dec 2009 06:30:37 -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/03/t1259847084469jh93unecrlla.htm/, Retrieved Thu, 03 Dec 2009 14:31:32 +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/03/t1259847084469jh93unecrlla.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:
JSSHWWS9P9
 
Dataseries X:
» Textbox « » Textfile « » CSV «
11.1 10.9 10 9.2 9.2 9.5 9.6 9.5 9.1 8.9 9 10.1 10.3 10.2 9.6 9.2 9.3 9.4 9.4 9.2 9 9 9 9.8 10 9.8 9.3 9 9 9.1 9.1 9.1 9.2 8.8 8.3 8.4 8.1 7.7 7.9 7.9 8 7.9 7.6 7.1 6.8 6.5 6.9 8.2 8.7 8.3 7.9 7.5 7.8 8.3 8.4 8.2 7.7 7.2 7.3 8.1
 
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
111.111.1000
210.910.9023139605178-0.197877275849182-0.00231396051779417-0.519268296715333
31010.0192310725768-0.860783815387878-0.0192310725767628-1.75760425368065
49.29.19482653488939-0.825853972813150.00517346511060820.0910733826338701
59.29.17898470917852-0.04767953085340810.02101529082147492.03083000302882
69.59.496613457038420.3033172553812260.003386542961582030.91596087871694
79.69.608751817861680.119631753029153-0.00875181786168083-0.479345721896692
89.59.50570325546266-0.094319524744667-0.00570325546266232-0.558327255182972
99.19.10770352363868-0.386095916729550-0.00770352363868439-0.761419673784439
108.98.89407385611935-0.2203900612668250.005926143880652470.432426001083685
1198.99338280030020.08677724702616450.006617199699795580.801583808956906
1210.110.07587543507731.043462156930630.02412456492272052.49656494473471
1310.310.32724357285300.282609815447896-0.0272435728530215-1.98625483889208
1410.210.1930624323175-0.1180145917630280.0069375676824756-1.04965212704135
159.69.61906717509268-0.54608704578929-0.0190671750926754-1.12797678282709
169.29.20693966770739-0.420475494555885-0.006939667707392410.327427338297058
179.39.276230991980640.03856788491942140.02376900801936501.19806338758620
189.49.39514283055270.1138914189594750.004857169447307010.196563696564963
199.49.41378045759690.0245898482455449-0.0137804575968885-0.233041580372739
209.29.20218397826148-0.196833786966918-0.00218397826147587-0.577827100212828
2199.00686393673775-0.195414658049320-0.006863936737746410.00370335885872557
2298.97362998957414-0.0433707818961410.02637001042585860.396773703549157
2399.045622027702040.0647823568253091-0.04562202770204320.282236524362768
249.89.72811843223820.6438785721296550.07188156776178991.51121218099864
251010.0411966820570.333836916004252-0.0411966820570087-0.809447417810787
269.89.78715326990133-0.217578113459660.0128467300986743-1.44159878044086
279.39.31726595248606-0.451057299275273-0.0172659524860579-0.612360284747078
2899.02276410745842-0.305990234073916-0.02276410745842140.37832176822637
2998.97216330472896-0.06960175301448640.02783669527104320.616906127733932
309.19.090532378419460.1044391493265230.009467621580536770.454181547716595
319.19.106463258496210.0224874125032467-0.00646325849621339-0.213861223369617
329.19.10065244854538-0.00371398418596567-0.00065244854538207-0.068375180528351
339.29.206213995665440.0974637128296588-0.006213995665442260.264033327056016
348.88.78512717529671-0.3826626612529070.0148728247032879-1.25293782103530
358.38.39135189386244-0.392951970598074-0.0913518938624389-0.0268510404219564
368.48.31038932075387-0.1040950188629240.0896106792461310.753803795253862
378.18.11910483601663-0.184804100431604-0.0191048360166275-0.210734473624561
387.77.67597026841-0.42404355090580.0240297315899946-0.624685550084273
397.97.88294297515470.1559005678482700.01705702484529851.51741587970476
407.97.941964717189820.0667057965112374-0.0419647171898167-0.232720465944251
4187.991337252220270.05076626021481350.00866274777973165-0.0415924660434171
427.97.89005066671207-0.08909731227702870.00994933328792953-0.364999188609893
437.67.61133181373123-0.263529391031732-0.0113318137312261-0.455196598605809
447.17.13751958385879-0.456964842218547-0.0375195838587898-0.504789479440009
456.86.75989621165295-0.3839809613709710.04010378834705020.190458739553836
466.56.46750805438957-0.2997267005243450.03249194561043390.219869964197356
476.96.978625888113840.446157526532614-0.0786258881138351.94646696161207
488.28.080070356041981.048886108524190.1199296439580151.57289977650452
498.78.708367648205170.662062153029747-0.00836764820516827-1.01002821703670
508.38.38313990557518-0.246030202978635-0.0831399055751773-2.36991742040616
517.97.88394172020598-0.4778398286998880.0160582797940225-0.605824340497071
527.57.53419178862317-0.360374393246054-0.03419178862317320.306566532113275
537.87.75509850943280.1721590582387680.04490149056719631.38946734900905
548.38.267970597485810.4843467064840050.03202940251418780.814719274910062
558.48.417286277520010.177335316925176-0.0172862775200103-0.80117379363102
568.28.25656920572426-0.132443127222985-0.0565692057242573-0.808398084804553
577.77.65360277760855-0.5636076538553690.0463972223914529-1.12516697671528
587.27.1987688812449-0.4639319179872390.001231118755096910.260114049663913
597.37.414412706403270.158801166112815-0.1144127064032731.62508881005397
608.17.965756951448620.5184652249372820.1342430485513830.938609053421418
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/1fnv51259847034.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/1fnv51259847034.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/207f21259847034.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/207f21259847034.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/3wxfn1259847034.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/3wxfn1259847034.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/4dmpz1259847034.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t1259847084469jh93unecrlla/4dmpz1259847034.ps (open in new window)


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