Home » date » 2009 » Dec » 10 »

WS 9 Review 3 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: Thu, 10 Dec 2009 11:55:45 -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/10/t1260471386pb54r8x8wn4ny88.htm/, Retrieved Thu, 10 Dec 2009 19:56:33 +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/10/t1260471386pb54r8x8wn4ny88.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 «
283.042 276.687 277.915 277.128 277.103 275.037 270.150 267.140 264.993 287.259 291.186 292.300 288.186 281.477 282.656 280.190 280.408 276.836 275.216 274.352 271.311 289.802 290.726 292.300 278.506 269.826 265.861 269.034 264.176 255.198 253.353 246.057 235.372 258.556 260.993 254.663 250.643 243.422 247.105 248.541 245.039 237.080 237.085 225.554 226.839 247.934 248.333 246.969 245.098 246.263 255.765 264.319 268.347 273.046 273.963 267.430 271.993 292.710 295.881 293.299
 
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
1283.042283.042000
2276.687279.643099949226-2.92361682846477-2.95609994922578-1.60260866952763
3277.915276.140559463114-3.261756285662101.77444053688619-0.125865216510943
4277.128275.559759426404-1.655331587442981.568240573595940.625674700662030
5277.103276.338883741368-0.1800070069982450.7641162586320770.536882429936485
6275.037275.60117321584-0.51149442481712-0.564173215840185-0.120727948617283
7270.15271.60358070987-2.58377139671973-1.45358070987009-0.761464920927339
8267.14267.303320934953-3.60804292510288-0.163320934952686-0.376027613640751
9264.993264.329183977815-3.229421931724690.6638160221847230.138895032605294
10287.259278.8965049642217.398469971225168.362495035778573.89920571124566
11291.186291.46110007156110.4826558430896-0.2751000715613011.13156009519430
12292.3295.8636214428266.85348046703138-3.56362144282566-1.33148594559240
13288.186292.2557464057330.659880772553535-4.06974640573311-2.31104249620351
14281.477286.251855201344-3.29403221142526-4.77485520134415-1.46225990329933
15282.656281.892745223988-3.907207723376370.763254776012354-0.222981966516256
16280.19279.177391289139-3.226419614219551.012608710860940.253176943380808
17280.408278.155724777872-1.948906809138892.252275222127570.472296549723932
18276.836275.44314718552-2.39018212684141.39285281447971-0.161077836539959
19275.216273.85075963422-1.931878592898961.365240365779750.167747256630069
20274.352274.118593889419-0.6669679969701730.2334061105807570.464367161811322
21271.311277.0051249135041.38092983527905-5.694124913504050.751506378766255
22289.802282.6167871706813.820324191085767.185212829318670.894942062131855
23290.726288.3959708104114.948723451482852.330029189589490.414038742564155
24292.3292.353305969474.37838610119883-0.0533059694697586-0.209592664946352
25278.506285.316536319926-2.19633091444993-6.81053631992616-2.42343573801538
26269.826276.256467579431-6.14771431710252-6.43046757943118-1.45003376242421
27265.861266.634641590441-8.12879440977871-0.773641590440527-0.724380148669477
28269.034265.086978257636-4.39244385315573.94702174236371.37611885262853
29264.176261.384315302726-3.998641439438732.791684697273780.145243433947237
30255.198254.689111649302-5.540849076981730.508888350698388-0.565358817642569
31253.353251.237668901975-4.349738274929762.115331098025210.435929106413505
32246.057247.567923625875-3.96258950990762-1.510923625875260.141949478481996
33235.372243.730269033852-3.89139064501295-8.35826903385190.0261260507276766
34258.556248.9556873653651.307153142766919.600312634635081.90760936506891
35260.993256.2905796337624.743209584889714.702420366237711.26134079557061
36254.663253.6670854754680.5434433757649970.995914524532434-1.54329364666324
37250.643253.6415451898880.218748236195865-2.99854518988786-0.119323540000477
38243.422250.621368195597-1.62730637310546-7.1993681955969-0.676709885244777
39247.105249.983560617877-1.06592851870523-2.878560617876720.205616875082688
40248.541246.003758049731-2.715433789500172.53724195026863-0.606230501450016
41245.039241.424549571363-3.773240818555483.61445042863657-0.389366177369497
42237.08236.939737742876-4.177867997847960.140262257124481-0.148538252076744
43237.085233.95956975557-3.497760217385893.125430244430200.249143942575550
44225.554228.694666217751-4.49947570767945-3.14066621775122-0.367107800009838
45226.839234.7025602421641.45475009444517-7.863560242164462.18424387096914
46247.934239.9354098737833.596314379497167.998590126217230.78606664695112
47248.333241.8379337502432.63589526214666.49506624975652-0.352698905034626
48246.969245.1634259079073.02717145061961.805574092092910.143736203847724
49245.098247.5747278062962.67755544773851-2.47672780629557-0.128339536551380
50246.263252.6886531322274.05883059350544-6.425653132227420.506263793426672
51255.765257.3126339091064.37833178738536-1.547633909106070.117099126771383
52264.319261.0293907431144.004784449170483.28960925688568-0.137195330543637
53268.347264.2459993166803.559073015377364.10100068332029-0.163895920974508
54273.046271.0336843974025.387645423661912.012315602598470.671488106668861
55273.963272.7624158320253.316603795045821.20058416797530-0.75918263216
56267.43275.1943227759542.81665594756149-7.76432277595415-0.183216475363602
57271.993280.1860834017454.04463347747718-8.193083401744680.450382121364642
58292.71284.2117927849524.033949639436758.4982072150479-0.00392200071173293
59295.881289.0685614333174.498771025024026.812438566682930.170729131214369
60293.299292.1353367761303.689146571897521.16366322386956-0.2973494716982
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/1riqv1260471343.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/1riqv1260471343.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/27v431260471343.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/27v431260471343.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/3vs1i1260471343.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/3vs1i1260471343.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/4lzrp1260471343.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/10/t1260471386pb54r8x8wn4ny88/4lzrp1260471343.ps (open in new window)


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