Home » date » 2009 » Dec » 04 »

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 12:26:25 -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/t125995488925cjzhv214d9lm0.htm/, Retrieved Fri, 04 Dec 2009 20:28:16 +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/t125995488925cjzhv214d9lm0.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 «
7.3 7.6 7.5 7.6 7.9 7.9 8.1 8.2 8 7.5 6.8 6.5 6.6 7.6 8 8.1 7.7 7.5 7.6 7.8 7.8 7.8 7.5 7.5 7.1 7.5 7.5 7.6 7.7 7.7 7.9 8.1 8.2 8.2 8.2 7.9 7.3 6.9 6.6 6.7 6.9 7 7.1 7.2 7.1 6.9 7 6.8 6.4 6.7 6.6 6.4 6.3 6.2 6.5 6.8 6.8 6.4 6.1 5.8 6.1 7.2 7.3 6.9 6.1 5.8 6.2 7.1 7.7 7.9 7.7 7.4 7.5
 
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
17.37.3000
27.67.596395402372010.234285422268640.00360459762799170.872311949205638
37.57.49357827748373-0.07506796121311550.00642172251626942-0.970173911050916
47.67.593699243402270.08564596170000330.006300756597729150.532724146801564
57.97.893711394606580.2824141659922230.006288605393423680.652468147237377
67.97.893710081175750.02316965422484480.00628991882425245-0.859636822184238
78.18.093710148645730.1854925900532740.006289851354267680.538251606697165
88.28.193710145969550.1070139321738190.00628985403044805-0.260229791212702
987.9937101451811-0.1748121457620420.00628985481890516-0.93451574480604
107.57.49371014511258-0.4733211316681790.00628985488742043-0.989835111564299
116.86.79371014510866-0.6814029472410580.00628985489133873-0.689984881047587
126.56.4937101451092-0.3312908335234640.006289854890797841.16094750745841
136.66.622494024819470.0871420213598957-0.02249402481946801.46296838828869
147.67.587536106825190.7972277513562760.01246389317480742.31033551408993
1587.985590558685020.4309751284679690.0144094413149839-1.17879502927377
168.18.085457608955550.1271446157910270.0145423910444483-1.00728304615704
177.77.6854402367889-0.3567524122774740.0145597632110952-1.60456689144521
187.57.48544066059922-0.2128601878889700.01455933940077750.477136640564384
197.67.585440729996220.07433251073392630.01455927000377980.95231108705789
207.87.785440732283120.1896900626637040.01455926771688390.382517648296371
217.87.785440731999910.01556243918617110.0145592680000890-0.57739513297434
227.87.785440731998000.001276764370375380.0145592680019952-0.0473703077384437
237.57.48544073199498-0.2752828310672620.0145592680050227-0.917052453792022
247.57.4854407319952-0.02258459013257050.01455926800479580.837929855774401
257.17.27226335877404-0.196530167346724-0.172263358774043-0.596561262010691
267.57.480906152310510.1438345235508800.01909384768949291.11702491797441
277.57.480394253591650.01137572427170720.0196057464083517-0.429865863048256
287.67.580420124225080.0927309007112590.01957987577491710.269729622804666
297.77.680420298312480.09940363385599330.01957970168751530.0221262994531427
307.77.680420103003560.0081552136578660.0195798969964388-0.302573436202211
317.97.880420133928080.1842607842578130.01957986607192260.58395386854156
328.18.080420134136220.1987087326326630.01957986586377620.0479083956152225
338.28.180420134029130.1080982030748930.0195798659708724-0.300458236998992
348.28.18042013401950.008868528418748380.0195798659804946-0.329038724866522
358.28.180420134019440.0007275865285167670.0195798659805593-0.0269947991672508
367.97.88042013401926-0.2753278863888010.0195798659807396-0.91538081844869
377.37.5193445893845-0.353709715765585-0.219344589384493-0.266412201014775
386.96.88192914455305-0.5969513646596310.0180708554469515-0.801098916764735
396.66.5827591201618-0.3236737728358340.01724087983820200.891022041950161
406.76.682856251489060.06524781942366350.01714374851093731.28949248454303
416.96.882858786011130.1889447559802440.01714121398887400.410170160360221
4276.98285864876070.1072971526526330.0171413512393016-0.270737793346502
437.17.08285864783690.1005986686534210.0171413521631056-0.0222117087575052
447.27.182858647830680.1000491156172380.0171413521693236-0.00182227978574612
457.17.08285864766021-0.08358768955883620.0171413523397862-0.608926920531383
466.96.88285864765208-0.1904493705346370.0171413523479243-0.354345928949323
4776.982858647653740.07617112566607930.01714135234625850.884095089469596
486.86.78285864765361-0.1773425329308140.0171413523463885-0.840633724236474
496.46.58914992692075-0.192316358738675-0.189149926920748-0.0506304848348785
506.76.68127114218430.05468772026955990.01872885781570560.814982755297965
516.66.58091521163117-0.08760447543058670.0190847883688329-0.465341983043639
526.46.38089399715998-0.1907803571708810.0191060028400165-0.342092499914615
536.36.28089540290874-0.1074477401660720.0191045970912580.276325011665894
546.26.18089541237053-0.1006110230602440.01910458762946540.0226700800659161
556.56.480895454125190.2671333089575690.01910454587481141.21941472145232
566.86.780895454406230.2973035705011860.01910454559376960.100042496577755
576.86.780895454197660.02439120252682360.0191045458023379-0.904958500264783
586.46.38089545417324-0.3651823496300970.0191045458267636-1.29179890277406
596.16.08089545417354-0.3053476515210430.01910454582645580.198407712579930
605.85.78089545417355-0.3004387288422830.01910454582645380.0162776474304136
616.16.286022512032990.437023850462163-0.1860225120329872.48511089966492
627.27.18100002249470.8382020033515150.01899997750529931.32513066817445
637.37.279556538150450.1593656406191950.0204434618495487-2.22467789645746
646.96.87946681357677-0.3541149639107080.0205331864232308-1.70253256245747
656.16.07946094583202-0.7634189980982260.0205390541679799-1.35722309747112
665.85.77946144616051-0.3380195453091720.02053855383948871.41059510164002
676.26.179461511531090.3394518398574430.02053848846890672.24644816659836
687.17.079461515604530.854011841576530.02053848439547441.70624530836807
697.77.679461515453090.6208394882767810.0205384845469122-0.773183365457345
707.97.87946151543250.2345262627439690.0205384845674963-1.28098788561853
717.77.67946151543076-0.1643508550538260.0205384845692399-1.3226488817324
727.47.37946151543072-0.2888711536111220.0205384845692847-0.412900681164878
737.57.710147141511730.278539781442523-0.2101471415117251.90750876607253
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t125995488925cjzhv214d9lm0/1ktuf1259954782.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t125995488925cjzhv214d9lm0/1ktuf1259954782.ps (open in new window)


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


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


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


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