Home » date » 2009 » Dec » 04 »

workshop 9,10

*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: Fri, 04 Dec 2009 12:09:52 -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/04/t1259953848783lfbjnx1b8rbw.htm/, Retrieved Fri, 04 Dec 2009 20:10:55 +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/04/t1259953848783lfbjnx1b8rbw.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 «
611 594 595 591 589 584 573 567 569 621 629 628 612 595 597 593 590 580 574 573 573 620 626 620 588 566 557 561 549 532 526 511 499 555 565 542 527 510 514 517 508 493 490 469 478 528 534 518 506 502 516 528 533 536 537 524 536 587 597 581 564
 
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' @ 72.249.127.135


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
1611611000
2594600.890077038808-10.6793508169096-6.89007703880759-1.80337200823213
3595590.132927178394-10.72875391575754.86707282160587-0.00662790276498473
4591587.158585444541-5.601997864494563.841414555458520.726000183754626
5589587.457975751064-1.699433441100811.542024248935570.511064434697025
6584584.803314038063-2.31867121307166-0.803314038063031-0.0815642560340103
7573575.350598766063-6.95407530653793-2.35059876606268-0.61357948024576
8567566.489146759818-8.196765034859510.510853240182474-0.164174374038259
9569565.534716887839-3.476816365959683.465283112161050.623424007260352
10621604.69157236857724.302896177694116.30842763142273.66959521756889
11629632.64361096588426.6800781232648-3.643610965883640.314007345084002
12628636.94634750935112.1041838444222-8.94634750935132-1.92534927868203
13612621.097434092153-6.03681289967139-9.0974340921529-2.40571170016917
14595603.606889533705-13.5044740366100-8.60688953370532-1.00268674995515
15597593.01700511195-11.65303263479273.982994888049760.242380254418430
16593589.156891698458-6.780145545929053.843108301542090.652622413957651
17590586.671446486108-4.059732710653013.328553513892250.362119643211553
18580577.986920095679-6.973110724524292.01307990432117-0.383179200641831
19574571.375675431364-6.746396353318332.624324568636050.0299279349434804
20573572.198857688032-1.996518153947830.8011423119679440.627993866454083
21573582.4875946928085.72430331283231-9.487594692808241.01987751759528
22620602.53134675747314.725328585144417.46865324252721.18895941486567
23626621.87865376602417.62907938224014.121346233975980.383580524407892
24620625.0184124479348.53716456531325-5.01841244793429-1.20159962401871
25588603.737412064846-10.1792332084258-15.7374120648462-2.48023872115726
26566579.452771640999-19.0451485994616-13.4527716409988-1.17316184100839
27557556.82416849091-21.27983200971980.175831509090555-0.294269186980529
28561551.368612128642-11.47067627285399.631387871358471.30011571574711
29549542.393425817566-9.916227768352326.606574182434210.206362142630146
30532529.288254389853-11.90391953110712.71174561014708-0.262304976459346
31526522.618612806552-8.65331773114493.381387193447790.428682137665396
32511515.556765228615-7.665603441677-4.556765228615290.130480696135232
33499514.103692140889-3.80543566060573-15.10369214088870.50998956029736
34555533.07190538926310.351480317163521.92809461073711.87003509218902
35565553.51865214147616.624706560616611.48134785852390.828747654724153
36542545.5981712443541.37722427140755-3.59817124435393-2.01574839720102
37527538.121887572847-4.12699430766737-11.1218875728465-0.728236534754263
38510525.831915535641-9.20089463108307-15.8319155356407-0.670173352040899
39514518.723581025135-7.9054367041488-4.723581025135450.170862476894353
40517508.634588800205-9.253585005881188.36541119979469-0.178331662818988
41508499.04894074898-9.4590582725888.95105925102045-0.0272199956210121
42493490.103188803812-9.141008790238552.896811196187880.0420227461999915
43490484.434930884789-6.993013070287325.56506911521070.283393626137543
44469477.544575803353-6.929596250581-8.544575803352580.00837278519233984
45478494.6621297822797.92914139846875-16.66212978227931.96284999813464
46528509.31042629512312.082450156913318.68957370487650.548708235659699
47534515.8610859675648.6630798040111318.1389140324358-0.451836215151636
48518519.5458685626845.58517408378212-1.54586856268413-0.406891413221724
49506517.3086780890810.74611671266553-11.3086780890814-0.639668806212862
50502518.163160392280.813111570403526-16.16316039227970.00884537791369302
51516519.5609226034321.17366170584363-3.56092260343250.0475832440995858
52528519.3098884318250.2963424920021578.69011156817484-0.115981796338448
53533521.8910027761051.7050595439903411.10899722389490.186430479481245
54536530.2625887801245.820286121506675.737411219875650.543911552792706
55537533.7440189371974.377676952267503.25598106280276-0.190418594400508
56524541.2105424312686.28048378321375-17.21054243126780.251181019527817
57536553.61935039614410.0542087786444-17.61935039614390.498433497753699
58587566.07086883202411.530655498127420.92913116797610.195082946548739
59597577.04760419973211.189418644187419.9523958002677-0.0451001588481676
60581581.9698892617197.3268804338397-0.969889261718967-0.510572477883051
61564578.8902990397760.911103941072681-14.8902990397762-0.847732019687734
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/1qssk1259953789.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/1qssk1259953789.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/2e0y71259953789.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/2e0y71259953789.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/37nqw1259953790.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/37nqw1259953790.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/4neqc1259953790.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259953848783lfbjnx1b8rbw/4neqc1259953790.ps (open in new window)


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