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 08:49:46 -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/t1259941823ois2kazam6sa337.htm/, Retrieved Fri, 04 Dec 2009 16:50:29 +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/t1259941823ois2kazam6sa337.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 «
6,3 6,2 6,1 6,3 6,5 6,6 6,5 6,2 6,2 5,9 6,1 6,1 6,1 6,1 6,1 6,4 6,7 6,9 7 7 6,8 6,4 5,9 5,5 5,5 5,6 5,8 5,9 6,1 6,1 6 6 5,9 5,5 5,6 5,4 5,2 5,2 5,2 5,5 5,8 5,8 5,5 5,3 5,1 5,2 5,8 5,8 5,5 5 4,9 5,3 6,1 6,5 6,8 6,6 6,4 6,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
16.36.3000
26.26.20029716796157-0.0997273913760922-0.000297167961573839-0.408489295620644
36.16.09979513470036-0.1004952433609230.000204865299644-0.00315455903164451
46.36.29775427128150.1945004423025070.002245728718502391.20650272869622
56.56.500562445984510.202713665487683-0.000562445984512170.0335939443753683
66.66.600852426945270.101453906892288-0.000852426945274272-0.414174750832066
76.56.50139486682477-0.0971738506217298-0.00139486682476845-0.812431313242722
86.26.20122037797162-0.297867060449616-0.00122037797162428-0.820879468979458
96.26.19739745601969-0.007165187783229050.002602543980308831.18903474146113
105.95.90282639286309-0.291304249880994-0.00282639286308901-1.16219139953108
116.16.095772781450590.1874421291645290.004227218549411761.95817822504077
126.16.102375588359890.00865832620058987-0.00237558835988872-0.731265165183998
136.16.0996405840477-0.002604700689821780.000359415952302765-0.0460731379892089
146.16.09809831207916-0.00155420588619360.001901687920838570.00430205186249085
156.16.10291534583540.00469486711094491-0.002915345835404030.0256578394536613
166.46.394244991097690.2852705138232400.005755008902313381.14739140623323
176.76.701308362131410.306606247633500-0.001308362131412720.087268661388703
186.96.902126502384120.203034133338359-0.00212650238411872-0.423632791071569
1976.997768332370550.09789201132337350.00223166762944939-0.430054457912472
2077.008315921668690.0123777493686246-0.008315921668692-0.349772182215832
216.86.79326621756893-0.2102843930652060.00673378243107212-0.910737246152639
226.46.41134286161733-0.378326971685546-0.0113428616173301-0.687331190051569
235.95.89519003324078-0.5132650426942110.00480996675922306-0.551926460204372
245.55.50019451632248-0.397473728734047-0.0001945163224806950.473612059831032
255.55.49465719433266-0.01377775659092320.005342805667344391.56957820207638
265.65.593730902963720.09672713804489150.00626909703628230.452416955990329
275.85.806746684078270.209852074922257-0.006746684078267320.464098493181313
285.95.898523290045530.09511718872022560.00147670995447078-0.469164425465421
296.16.097778847980910.1963158443092890.002221152019088220.413933193440927
306.16.104330513064650.0119001181821761-0.00433051306465253-0.754300675425817
3165.99991446133558-0.1011371116626638.55386644210451e-05-0.462347213530348
3266.002964331323930.000112641777257588-0.002964331323926590.41413381032798
335.95.89434647535882-0.1055525778987100.00565352464118018-0.432194041436554
345.55.51269607604272-0.37386678661241-0.0126960760427209-1.09746426305425
355.65.583337427623850.05811087063866140.01666257237614481.76688394868857
365.45.41302376348706-0.163873367966327-0.0130237634870574-0.90796494281159
375.25.19590335095372-0.2156152324306460.00409664904628482-0.211663423911762
385.25.19428115474978-0.007619954309600110.005718845250216970.851278105927362
395.25.201775041330490.00699657067112295-0.001775041330490060.0599187143655675
405.55.498503499783260.2870710012236960.001496500216735891.14524853621215
415.85.795351814713610.2965218904004010.004648185286385150.0386572323901912
425.85.805395053104330.0195907458893417-0.00539505310432997-1.13270845750806
435.55.5105019898551-0.284411449862545-0.0105019898550986-1.24343619640577
445.35.30200129586594-0.211031054021123-0.002001295865940920.300141992402568
455.15.07887731723402-0.2227208817975130.0211226827659831-0.0478139726638196
465.25.2212632362850.130215902004513-0.02126323628499811.44358925216182
475.85.770430161413820.5352033868830250.02956983858618101.65648848171649
485.85.820969596514870.0666979291113927-0.0209695965148683-1.91629208716602
495.55.50899350181228-0.299324133513849-0.00899350181227969-1.49734206190159
5054.991928494597-0.5098345194133330.00807150540300206-0.861346783766708
514.94.89890080864346-0.1083733118634570.001099191356543511.64473864820553
525.35.292973221718020.3755653390474560.0070267782819811.97894098427504
536.16.084119311104820.7757757080551150.01588068889518141.63698665582911
546.56.504601919868840.433598337150142-0.00460191986883882-1.39958013388923
556.86.81673879530260.316620496813262-0.0167387953025987-0.47846525350062
566.66.60588419853379-0.191380760373913-0.00588419853378606-2.07783711048498
576.46.38068298955593-0.2239525718843540.0193170104440707-0.133225890815008
586.46.435975401213380.0449831725585313-0.03597540121338281.10000648024379
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259941823ois2kazam6sa337/1ydlx1259941783.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259941823ois2kazam6sa337/1ydlx1259941783.ps (open in new window)


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


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259941823ois2kazam6sa337/35roq1259941783.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259941823ois2kazam6sa337/35roq1259941783.ps (open in new window)


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


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