Home » date » 2009 » Dec » 03 »

Ad hoc forecasting 3

*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, 03 Dec 2009 10:25:49 -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/03/t12598612074ypicxg40w153t0.htm/, Retrieved Thu, 03 Dec 2009 18:26:54 +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/03/t12598612074ypicxg40w153t0.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:
Uitleg in Word document
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
96.96 93.11 95.62 98.30 96.38 100.82 99.06 94.03 102.07 99.31 98.64 101.82 99.14 97.63 100.06 101.32 101.49 105.43 105.09 99.48 108.53 104.34 106.10 107.35 103.00 104.50 105.17 104.84 106.18 108.86 107.77 102.74 112.63 106.26 108.86 111.38 106.85 107.86 107.94 111.38 111.29 113.72 111.88 109.87 113.72 111.71 114.81 112.05 111.54 110.87 110.87 115.48 111.63 116.24 113.56 106.01 110.45 107.77 108.61 108.19
 
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
196.9696.96000
293.1195.6913669472083-0.000980021030655114-2.58136694720834-2.35439870022924
395.6294.8736856730539-0.07151901415057740.746314326946155-0.843449423446045
498.396.01533591939820.05276497899003412.284664080601811.43549603843488
596.3896.44760317099530.0940450311107307-0.06760317099532060.514396721777169
6100.8298.16785975590320.2792679663291272.652140244096792.268052813189
799.0699.11862196770980.359601884479845-0.05862196770979610.92162536853751
894.0397.59606609729480.123310476354771-3.56606609729481-2.53072956565060
9102.0798.76499679333060.2601861079834933.305003206669411.38499001785332
1099.3199.39728482479820.310521604107985-0.08728482479816680.487976288400459
1198.6499.36433224307270.262934354531628-0.724332243072709-0.447416127904472
12101.82100.3254315959310.3612727113897591.494568404068510.905238791566546
1399.14100.0935228709620.281118249826728-0.953522870961724-0.779133950577501
1497.63100.2196871546770.259560722137456-2.58968715467741-0.207945451559612
15100.06100.4442249408640.254555729207507-0.384224940864347-0.0442832205175691
16101.32100.3300015619040.201763459010150.989998438095807-0.449635778160728
17101.49101.2185719752410.299678803626980.2714280247590830.849420626623094
18105.43102.1251162864160.3861833440900643.304883713584310.767563496073078
19105.09103.3137212793770.5007891071443261.776278720623161.02198740401359
2099.48103.9920853064020.526174494803314-4.512085306401550.225129444599609
21108.53104.8959251177430.580125421411543.634074882257010.475465674998847
22104.34105.1394375280490.5321214313157-0.799437528048958-0.421640736441573
23106.1106.1089224487520.594354402416231-0.008922448751978560.546819405868286
24107.35106.3143047424790.539123195871311.03569525752134-0.48782863608616
25103105.6096434958730.362575165195605-2.60964349587308-1.57388148443057
26104.5106.076373913790.377400403085289-1.576373913789900.132346390257091
27105.17106.1765106991940.337866657635272-1.00651069919392-0.348798959420721
28104.84105.7070779387820.222975899857415-0.867077938782345-1.00339196360372
29106.18105.9849843180160.2307700905033470.1950156819838150.0682097205664772
30108.86106.2187468545090.2311942687012442.641253145490620.00374328243966299
31107.77106.3691413685730.2197286570435031.4008586314268-0.101655097675369
32102.74106.8986070670060.263739395634661-4.158607067005930.389490496459233
33112.63107.8846217651100.3663870793004194.745378234890340.903999092855174
34106.26107.9799049095400.327900003699129-1.71990490954012-0.337764564139119
35108.86108.2114996086560.3142492773179390.648500391343989-0.119835732872230
36111.38108.8842833100020.3650198638152432.495716689997790.447353213592940
37106.85109.3629244868830.381113107618596-2.512924486882860.142362655773949
38107.86109.4807960574330.343789774283389-1.62079605743325-0.330251126803274
39107.94109.2306719645860.259540914608190-1.29067196458562-0.74260390625776
40111.38110.4100004079800.3899192428766600.9699995920202061.14486603829128
41111.29111.148790615020.4393074163970440.1412093849800300.433707369910372
42113.72111.5176723302110.4293442615518672.20232766978863-0.0877675937289686
43111.88111.5162545806380.3683855002423950.363745419362447-0.538398849073008
44109.87112.7334660427570.48858785721744-2.86346604275751.06139970862604
45113.72111.7537642707420.2806101682103901.96623572925750-1.83217261052912
46111.71112.2287655333100.308132937919581-0.5187655333101430.241957837634612
47114.81113.2904798387130.4147477537301561.519520161287100.93719175067661
48112.05112.2877215505020.214298740856166-0.237721550501600-1.76509080836131
49111.54112.6707489017000.238160946616792-1.130748901700430.210503334246384
50110.87112.7970860233920.222339535949491-1.92708602339242-0.139596124003331
51110.87112.9376187097070.210762397569870-2.06761870970746-0.101994701269503
52115.48113.7191145340120.2915100834386551.760885465988360.710247001111174
53111.63113.1439439274480.168957211384853-1.51394392744759-1.07776134551946
54116.24113.3165247328700.1694694293785592.923475267130250.00450996867662962
55113.56113.4297435252240.1615174905261880.130256474775515-0.0701014886635743
56106.01111.482499538652-0.136677084923912-5.47249953865152-2.62906421090012
57110.45109.846096888250-0.3487823225261110.603903111750462-1.86826176844829
58107.77108.736963978813-0.456301468765184-0.966963978812583-0.946090585318997
59108.61107.368862237890-0.5851938344660151.24113776211045-1.13397580907822
60108.19107.270653538738-0.5163694927536320.9193464612616170.605936834763827
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/1xoj71259861147.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/1xoj71259861147.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/2kgkz1259861147.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/2kgkz1259861147.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/3gp6u1259861147.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/3gp6u1259861147.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/4o6kq1259861147.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/03/t12598612074ypicxg40w153t0/4o6kq1259861147.ps (open in new window)


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