Home » date » 2009 » Dec » 04 »

WS 9 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: Fri, 04 Dec 2009 03:23:01 -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/t1259922225ohkno5kv3pm2ev7.htm/, Retrieved Fri, 04 Dec 2009 11:23:53 +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/t1259922225ohkno5kv3pm2ev7.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:
SHW WS 9 Structural Time Series Models
 
Dataseries X:
» Textbox « » Textfile « » CSV «
14.2 13.5 11.9 14.6 15.6 14.1 14.9 14.2 14.6 17.2 15.4 14.3 17.5 14.5 14.4 16.6 16.7 16.6 16.9 15.7 16.4 18.4 16.9 16.5 18.3 15.1 15.7 18.1 16.8 18.9 19 18.1 17.8 21.5 17.1 18.7 19 16.4 16.9 18.6 19.3 19.4 17.6 18.6 18.1 20.4 18.1 19.6 19.9 19.2 17.8 19.2 22 21.1 19.5 22.2 20.9 22.2 23.5 21.5 24.3 22.8 20.3 23.7 23.3 19.6 18 17.3 16.8 18.2 16.5 16 18.4
 
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
114.214.2000
213.513.6962936202158-0.0218460906336913-0.196293620215784-0.510961302574374
311.912.5702624714998-0.0799509747537027-0.670262471499777-1.28905027878636
414.613.5370438654530-0.04615112368630381.062956134546981.46329923993990
515.614.8464248791018-0.02392546807888680.7535751208981711.95715040105429
614.114.6933425081781-0.0252516531120534-0.593342508178087-0.186791276444708
714.914.7846758745439-0.02417223680943290.1153241254560860.168450679883035
814.214.4884285371524-0.026809952089474-0.288428537152382-0.392773401016692
914.614.5009388600968-0.02641283473224800.09906113990323520.0567382164401477
1017.215.9906933974858-0.01092317548608951.209306602514172.18754213010685
1115.415.9531568795025-0.0111935144893430-0.55315687950249-0.0383985440214962
1214.315.0428351737731-0.0202241712770097-0.742835173773071-1.29732709720659
1317.515.8445774986595-0.04392159038615291.655422501340531.28248841532129
1414.515.1386898929531-0.0440762184398627-0.638689892953074-0.956503842745318
1514.415.3125085376162-0.0395886555083069-0.9125085376162150.290041437516813
1616.615.7595887304915-0.02857558105195300.8404112695084740.669989945447174
1716.715.8833206620207-0.02601999576182790.8166793379792870.217177605013153
1816.616.5663305059722-0.01814429507456290.03366949402776931.02223378168815
1916.916.7138164028435-0.01679637143252050.1861835971564550.239206876790042
2015.716.4580578485087-0.0185438447733307-0.758057848508664-0.345069547894469
2116.416.6882200247152-0.0166973840672004-0.2882200247151940.359040185774239
2218.416.9319367557831-0.01480722907305921.468063244216940.375838750550512
2316.917.0767935804617-0.0139431355412167-0.1767935804616840.230235386400481
2416.517.3491456998188-0.0137442623144000-0.8491456998188030.41346327500924
2518.316.9193860039223-0.01169067008446131.38061399607775-0.609305430076157
2615.116.3534377019843-0.0125862934937511-1.2534377019843-0.79657961809902
2715.716.5418742525155-0.0103600918800077-0.8418742525155070.279518673783194
2818.117.0212199201116-0.002903343624512521.078780079888380.682027894419079
2916.816.7142445080592-0.007230115579343320.0857554919407617-0.43139289913556
3018.917.78384746800020.004876587681267431.116152531999851.54656750785754
311918.42086110981640.01035737652969510.5791388901835530.911993503563147
3218.118.82179042507460.0131587939088284-0.7217904250746430.564106828493199
3317.818.59666721483950.0116609695805094-0.796667214839529-0.344116422627190
3421.519.37172077203380.01560813215372012.128279227966191.10155994887272
3517.118.44814321371710.0125830048153362-1.34814321371715-1.35410045289478
3618.718.74565774622860.0128163868799370-0.04565774622862470.411320851329926
371918.10602381193630.01282280942285990.89397618806374-0.94318038422607
3816.417.86389160263680.012031102129274-1.46389160263678-0.364909874229781
3916.917.87196295580720.0119996193423882-0.971962955807191-0.00558288949162498
4018.617.69896947581170.009935327894282760.901030524188335-0.260187794118112
4119.318.77535440153830.02237817980862320.5246455984616831.51362961246257
4219.418.86005314265830.02302389001560750.5399468573416710.0893083145149912
4317.618.02975078906550.0157359945700344-0.429750789065486-1.22942482034335
4418.618.58096011489360.01944609424342230.01903988510638780.77294592443537
4518.118.95411578078900.0214121214346974-0.8541157807889670.51059396860266
4620.418.44427030953370.01920265703125511.95572969046633-0.766288873106567
4718.118.90655249142770.0203767240500655-0.806552491427690.638717058582607
4819.619.17616005399870.02075270111841420.4238399460013020.359315647383104
4919.919.07052804774790.02054025297818290.829471952252136-0.181938014290561
5019.219.89807075787930.0235132400234149-0.6980707578793281.15412229369438
5117.819.49015068041050.0206687710323164-1.69015068041052-0.611959182569259
5219.219.08183665491790.01686031296745560.118163345082099-0.60712352175694
532220.22481694081390.02778710436901811.775183059186091.60147036004313
5421.120.39668855829170.02911230258974940.7033114417082820.206319304538089
5519.520.33148614175590.0283612770781370-0.831486141755915-0.135715902666664
5622.221.32433728683150.03465254446283670.8756627131684591.39088119093849
5720.921.59881553165940.0358768768914523-0.6988155316594210.345947200063953
5822.221.08109327142450.03379274491603741.11890672857555-0.7981356278653
5923.522.74525612725020.03808309583546730.7547438727497912.3493292309355
6021.522.16711613110250.0368199501355184-0.667116131102471-0.887476799362390
6124.322.93006120001300.03858771689290821.369938799987031.04361331108593
6222.823.23088317963780.0396008318279125-0.4308831796378320.375146174328563
6320.322.63756747405280.0359232147716827-2.33756747405279-0.900854601113942
6423.723.35171885473940.04098330048934640.3482811452605550.963769543552018
6523.322.56562922251580.03416082272937570.73437077748417-1.17859557606987
6619.620.63885844696450.0182954704975575-1.03885844696454-2.80788066228598
671819.71385625618040.0114594678733042-1.71385625618036-1.35616078818596
6817.317.96302263698320.000778064530874426-0.663022636983215-2.53892632526007
6916.817.4806259685557-0.00153895237867139-0.680625968555701-0.696448362145635
7018.217.5804328557332-0.001170674450694410.6195671442668060.146037657290146
7116.516.5566294477317-0.00400215643104431-0.0566294477316673-1.47289973064485
721616.6527506842698-0.00375817701028089-0.6527506842697530.144091047663971
7318.416.8769270349950-0.003114788990107971.523072965004970.327384222430384
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259922225ohkno5kv3pm2ev7/1j98d1259922178.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259922225ohkno5kv3pm2ev7/1j98d1259922178.ps (open in new window)


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


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259922225ohkno5kv3pm2ev7/3uxum1259922178.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259922225ohkno5kv3pm2ev7/3uxum1259922178.ps (open in new window)


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


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259922225ohkno5kv3pm2ev7/5zuv81259922178.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259922225ohkno5kv3pm2ev7/5zuv81259922178.ps (open in new window)


 
Parameters (Session):
par1 = multiplicative ; par2 = 12 ;
 
Parameters (R input):
par1 = 12 ; par2 = 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