Home » date » 2009 » Dec » 11 »

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, 11 Dec 2009 02:15:19 -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/11/t1260522985afz46utfg0pac49.htm/, Retrieved Fri, 11 Dec 2009 10:16:32 +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/11/t1260522985afz46utfg0pac49.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 «
108.8 128.4 121.1 119.5 128.7 108.7 105.5 119.8 111.3 110.6 120.1 97.5 107.7 127.3 117.2 119.8 116.2 111 112.4 130.6 109.1 118.8 123.9 101.6 112.8 128 129.6 125.8 119.5 115.7 113.6 129.7 112 116.8 127 112.1 114.2 121.1 131.6 125 120.4 117.7 117.5 120.6 127.5 112.3 124.5 115.2 104.7 130.9 129.2 113.5 125.6 107.6 107 121.6 110.7 106.3 118.6 104.6
 
Output produced by software:


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time7 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
1108.8108.8000
2128.4117.2111788249770.095590178861555511.16213248645492.91042415177307
3121.1122.6132648553010.446742285937217-1.522562349815271.27584387391735
4119.5122.4317038601640.406649382648722-2.930319386644-0.185107233242648
5128.7124.7642506139340.4970153529150693.930575697468830.652755825876451
6108.7119.4283511275760.314427530908749-10.7114641479625-2.07062832614314
7105.5112.6530973149820.158465266813489-7.13211396268631-2.54476718975896
8119.8113.2725135924590.1667286266414196.526114652858050.165735949731735
9111.3112.7147823712130.154572223289337-1.41262609499108-0.260287107656059
10110.6111.7485066687310.135748087886444-1.14517522864395-0.402205332917689
11120.1114.5739869337620.1815367604274255.518029004516860.964273439457565
1297.5109.0288990214160.0835286660817276-11.5119123385102-2.0520579284585
13107.7109.2404411743630.0814538545698723-1.540832152980860.0481474759572477
14127.3112.8831223778300.056386684847375214.40601520931261.33082013482536
15117.2116.0725194442300.1022301660724111.118893916596141.06917712514347
16119.8119.3240106093060.1871965070958470.4678770818097011.03683012395512
17116.2115.6740371883330.07451101541658370.536029683628525-1.29438045188072
18111115.5746772764580.0699802926197199-4.57420278283701-0.0605916767018478
19112.4117.1098183361920.101020040807521-4.713927074028220.520614000319272
20130.6119.8383966308850.14585184857379310.75413405747830.941596109887867
21109.1117.0491477884650.104399564248782-7.94075484394322-1.05487103715998
22118.8117.3847147607740.1071051860059221.414622638410720.0831074481886406
23123.9116.7020832925570.1001137548262427.20018335269996-0.283758824517858
24101.6115.7701787023400.0948073598168744-14.1672090196103-0.371235482538938
25112.8116.2641288649760.0955408813941065-3.465282957461350.144212800865412
26128116.3537046459130.095518335446298411.6463124649919-0.00213923242881425
27129.6121.1579162263890.1419198929060988.42895016313331.65005392130372
28125.8123.1795475984570.1716936225802222.615345802607060.647216238041346
29119.5122.4185393858580.153851167444917-2.91601813294827-0.321529571579393
30115.7122.044679114830.143587038697963-6.34323500915275-0.18429730523603
31113.6120.9567978717640.121735521118530-7.3533732526361-0.435876159858604
32129.7119.3200454432850.09512664223490810.3849044215012-0.627821539904236
33112119.0605220174020.090751907826279-7.05951671069976-0.127128210242285
34116.8117.4033417487490.073897953118858-0.598369862280964-0.627323265370247
35127117.7053972664860.07554040952482069.293952637566780.081901534534699
36112.1121.1835969567740.0937628455099252-9.093301202565821.22155101136178
37114.2121.4283674788840.0944847538632363-7.2287976403530.0541352741272421
38121.1118.4416902384150.07582758169208882.66702805978261-1.09800231279720
39131.6119.7219828980530.08642622582406611.87465127985730.424949908180246
40125120.7093328204430.09708144672887474.288179622876320.315284817311608
41120.4121.5778926865590.107883688253814-1.180013186768150.269681696819412
42117.7122.1825991999980.115228465688199-4.483970188772810.174596772256568
43117.5122.8063489854470.122463256085422-5.307763940030540.180059857507474
44120.6118.2628124414550.0630692138774252.35027621565872-1.66241181166642
45127.5122.7828158265100.1110443003305364.704609932946041.5937213351406
46112.3120.8354354129830.0930351472144077-8.52960853904714-0.737249490652575
47124.5119.0201122650900.07960314273884395.48529884885469-0.683842587799757
48115.2120.2534353672580.086480383281025-5.056707625798130.413279777203966
49104.7117.1110977933440.0678060931119178-12.4019559863291-1.15448580876976
50130.9120.7863519861430.091528417314048910.10348083062571.28474215063655
51129.2120.8158915321270.09102750972886778.38428200121722-0.0219596379699571
52113.5116.8367635878040.0512256512208885-3.32544059702542-1.43578630759011
53125.6119.4995747732660.0802766178358446.093180756125380.920351497895281
54107.6117.2935039284110.0534024354007198-9.68715266390997-0.80765911880492
55107114.3089353413250.0182361598947053-7.30045970956358-1.07760892098400
56121.6116.1016328118770.03726229407765655.493391904002910.631925100307959
57110.7112.3091934994920.00102101549997884-1.59841154879415-1.36763415269111
58106.3111.895588926665-0.00234246877659599-5.59441842845491-0.148292487865067
59118.6112.3193053771740.0006253244132903656.279490137795610.152464752920625
60104.6111.098500861179-0.00702497886673446-6.49504731022547-0.436941679997534
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/1nrsj1260522912.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/1nrsj1260522912.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/2y4xo1260522912.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/2y4xo1260522912.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/32vqk1260522912.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/32vqk1260522912.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/4epwk1260522912.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/4epwk1260522912.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/550wt1260522912.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260522985afz46utfg0pac49/550wt1260522912.ps (open in new window)


 
Parameters (Session):
par1 = 12 ; par2 = periodic ; par3 = 0 ; par5 = 1 ; par7 = 1 ; par8 = FALSE ;
 
Parameters (R input):
par1 = 12 ; par2 = periodic ; par3 = 0 ; par5 = 1 ; par7 = 1 ; par8 = FALSE ;
 
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