Home » date » 2009 » Dec » 02 »

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: Wed, 02 Dec 2009 14:19:07 -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/02/t1259788791ptpftisy5n0sjo6.htm/, Retrieved Wed, 02 Dec 2009 22:19:57 +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/02/t1259788791ptpftisy5n0sjo6.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 «
0.0314796223103059 -3.00870920563557 -2.07677512619799 -1.25010391965540 0.817975239137125 0.0252076485413113 0.554937772830776 0.230027371950115 2.35672227418686 1.41350455171120 2.73311719024401 1.31551925971717 -2.70076272244080 -0.721411049152714 -0.149388576811997 -0.118199629770334 -0.676562489695275 1.79699928690761 1.79845572032988 0.245100010770855 1.80710848932636 -1.75934771184948 -0.0186697168761931 0.189651523600062 -1.84149562719087 -1.07019530156943 -0.507291477584104 0.866365633831705 -1.76077926699189 -0.580719393339347 -0.435702079860853 -0.994868534845203 1.63136048315789 -1.1949403709466 -1.00525975426991 1.32302234837564 -0.628357549594746 0.632048410440518 -2.16903155809288 2.53779364144266 -0.632933703679292 -1.41749196342200 -0.455343045381255 0.812255211942954 0.627897309219833 0.650904313655623 -1.29800419154382 0.74391671726854 -1.50461634127457 -1.42734677658523 0.263353807408564 - etc...
 
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
10.03147962231030590.0314796223103059000
2-3.00870920563557-0.337859984836871-0.123113202382392-0.153436759095376-2.05955749182822
3-2.07677512619799-0.709604203587071-0.185270956474344-0.185865735543112-0.995014943027091
4-1.2501039196554-0.928920685940089-0.192080061650079-0.18529031273494-0.116144616839291
50.817975239137125-0.689068229444243-0.120091308625758-0.09106833810026021.37353653543211
60.0252076485413113-0.609751814053241-0.0916044909090781-0.0912449663015250.623809170681526
70.554937772830776-0.425316061107351-0.0570994604272071-0.04478925316694840.876900194796564
80.230027371950115-0.328188351538081-0.0399631082053763-0.03752531251681910.506663681018811
92.356722274186860.1611822793987790.01297026570884730.04559116809141431.8165914954529
101.41350455171120.4018847750828810.03367319570659780.03385869034866650.820736271441635
112.733117190244010.8334070951980250.066827289407310.09022803738928961.50930109389431
121.315519259717170.9608670644772480.07149134170514940.06245324294126680.24228216916783
13-2.70076272244080.9125104685059580.0629307747282609-0.732463638908291-2.17933242704605
14-0.7214110491527140.6680856916312480.04244040462139620.00909657936452334-1.17069055337286
15-0.1493885768119970.5582536562184780.03292337711926080.0302213377362605-0.614818643709566
16-0.1181996297703340.4760929803635060.02615372694430590.00813932661654078-0.498521227947173
17-0.6765624896952750.3220200256460730.01614113351865380.0135541398248013-0.832626770711557
181.796999286907610.5366842825629670.02658971896066640.07131735316415330.973152758639384
191.798455720329880.7235443365988440.03460323571442690.05621685715897470.83006549095896
200.2451000107708550.6938262196183970.0315403141575282-0.0166323523779194-0.350703795086036
211.807108489326360.847576942055390.03709533271568570.09488906226987780.69932370728707
22-1.759347711849480.5804127851965990.0238666592559258-0.0795039836124123-1.82235595792003
23-0.01866971687619310.5268931723363540.02064223125108530.0564684343821266-0.484013558286986
240.1896515236000620.5046240429927530.01892577682729790.0349609929985976-0.280503374220937
25-1.841495627190870.389270140869540.0137611737907398-0.254724170071894-1.52794292646426
26-1.070195301569430.2460674275054140.00794769648870773-0.0183011781312519-1.0452326201295
27-0.5072914775841040.1725848236018820.005039471474699170.0104305576599460-0.555639151846882
280.8663656338317050.2425483886805570.007278233323112130.04917300289384890.461484830401469
29-1.760779266991890.06443890816345540.00109864286177167-0.114862540034759-1.37061423861296
30-0.5807193933393470.00122788551389760-0.000975862477303480.0351870300457735-0.493580940212733
31-0.435702079860853-0.0414523212142378-0.002279123235141980.0212395364642590-0.331709514079693
32-0.994868534845203-0.119441415399855-0.00457336477909578-0.093674439949029-0.623085277070507
331.631360483157890.0108240738219333-0.0006075161320109450.1797337545951891.14661034875885
34-1.1949403709466-0.0756029597806416-0.00305950234545563-0.171689005949062-0.75307597417658
35-1.00525975426991-0.154820057768571-0.005174991113302140.0176248386783926-0.688907865313166
361.32302234837564-0.0542808312175853-0.002317850095348400.1271922188122490.990379756576892
37-0.628357549594746-0.0829553485932472-0.00301144660272508-0.101866706160584-0.345612060624114
380.632048410440518-0.0344549765229294-0.001690630739313720.04134188845268780.49732768724465
39-2.16903155809288-0.186727500127953-0.00545517806095646-0.138095474337901-1.46759701218477
402.53779364144266-0.0110938868259967-0.001038378271617130.2674298369065981.81368136259316
41-0.632933703679292-0.0430496195485981-0.00177450575854533-0.189162105198873-0.3182282809543
42-1.417491963422-0.139152857514633-0.00396819720523114-0.0217179566559275-0.996947869794296
43-0.455343045381255-0.167905679693075-0.004531484136440470.0516160745682807-0.268740639518525
440.812255211942954-0.103133724382716-0.00299140770428937-0.05735716501383870.770343197484806
450.627897309219833-0.0716115302370842-0.002241112011899780.2028555810141200.392986893703714
460.650904313655623-0.0202645828473225-0.00110094053526868-0.1188486341202660.624625821615639
47-1.29800419154382-0.0947240222227177-0.00262924259443798-0.0957231302269195-0.875016785424487
480.74391671726854-0.0588193515525736-0.001842836201283250.2022862596756810.473798361432027
49-1.50461634127457-0.119992930518855-0.00302945105658321-0.208417934589222-0.920249067996743
50-1.42734677658523-0.202142045837650-0.004580817022508930.0415931699430216-1.00334328447356
510.263353807408564-0.172088230247541-0.00391476639534321-0.1198251988023250.440015640864886
52-0.430830854870631-0.203879200209112-0.004440732500366380.229128885971704-0.361218271192151
530.379576092518008-0.169737289497339-0.00372623910754898-0.09552988141009730.510410469441461
541.70309353400146-0.0743187411439252-0.001923606608258740.08540534654080921.33848623748116
55-3.12314448117342-0.229786100389650-0.00466545933392777-0.219038676757315-2.11437705674836
56-1.32526207118689-0.289519204058890-0.0056315583573543-0.0573483874067931-0.77312700438829
57-0.60032490743804-0.320613976735117-0.00607057929388660.181570918253374-0.364317983495049
581.23607137604666-0.247719439131744-0.004732187482068650.02582355489435181.15092684830282
590.738007075905376-0.198020565092148-0.00382500312337423-0.0884221861467460.808299372178697
600.899100896289585-0.160382719072617-0.003145284284965950.2564871012649820.632971369509908
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/1qofq1259788745.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/1qofq1259788745.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/2jhmi1259788745.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/2jhmi1259788745.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/36hpb1259788745.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/36hpb1259788745.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/4aj9r1259788745.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/4aj9r1259788745.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/591151259788745.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259788791ptpftisy5n0sjo6/591151259788745.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