Home » date » 2009 » Dec » 04 »

WS9 Ad Hoc Forecasting Structual 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:06: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/04/t1259939288pkptiqcnht5im2l.htm/, Retrieved Fri, 04 Dec 2009 16:08:14 +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/t1259939288pkptiqcnht5im2l.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:
KVN WS9
 
Dataseries X:
» Textbox « » Textfile « » CSV «
9487 8700 9627 8947 9283 8829 9947 9628 9318 9605 8640 9214 9567 8547 9185 9470 9123 9278 10170 9434 9655 9429 8739 9552 9687 9019 9672 9206 9069 9788 10312 10105 9863 9656 9295 9946 9701 9049 10190 9706 9765 9893 9994 10433 10073 10112 9266 9820 10097 9115 10411 9678 10408 10153 10368 10581 10597 10680 9738 9556
 
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
194879487000
287009410.6622196060514.8108814183293-642.752915342371-2.62458917471795
396279348.402960950178.02078819678196293.120717707555-0.664671325135038
489479192.92784714829-8.50367448345273-221.564622870867-1.26282999082043
592839172.06254172394-9.6570099828324113.156136112896-0.112903261111508
688299078.49383991027-16.3160406007255-231.291809831184-0.889906262034115
799479246.42952599754-4.29398424098241655.5955399677762.13703771174858
896289394.13197568563.88784536467991194.2867152915421.84896929418436
993189434.33417008785.54722596344084-126.1184829002540.452657917888549
1096059488.818976054087.52115489412555102.7603094078760.617558702801716
1186409323.678938419861.14200281874054-635.897744727849-2.19217046498565
1292149234.35550439917-2.006051657110584.79386592307969-1.15197052002735
1395679230.45376913785-2.00196394364269337.109387507222-0.0260403334206382
1485479186.98962196303-2.07779769166592-627.844170684221-0.562301320083703
1591859074.75238580067-4.15498867485569139.693470646838-1.37964439611391
1694709172.04499784956-0.88651791322982273.0174580445501.19150265866024
1791239181.4710330038-0.485173195438105-60.92722207415480.119021321536663
1892789308.785959607064.68018419285406-61.56605566809411.49787747031796
19101709429.393461030969.16153687268503711.8719070066241.39504374988515
2094349435.22592344819.04431862735718-0.376278508238181-0.0410484120550867
2196559501.9218270196510.8372983815244138.0190824817540.723823830116898
2294299452.069189359729.21038879562885-6.9508097652243-0.771232255723555
2387399401.89118088077.87844906618502-646.931275747359-0.760751721349243
2495529410.675953459547.89468763914617141.0781806572590.0116841337970853
2596879395.032115845667.5793584161868298.412950089261-0.305638803709976
2690199444.029421646488.11940645079544-436.3186831776150.5353335057332
2796729514.8304253919.12571451795844140.4158756043060.796654602451242
2892069441.2378033437.46306392857916-213.647486248494-1.03183614132802
2990699385.909721883355.99446764474676-300.778691902143-0.774889456941147
3097889491.082044045728.4899684483007271.5283783020551.22357523621751
31103129554.949888226349.89540179112183742.7847143014010.687999759794703
32101059698.5228161187413.1495405034614371.6654290402151.67702598767539
3398639741.861121915713.8276660028135113.1871631861650.382258350719207
3496569735.3138163336813.4174294774220-73.8942293904185-0.259921477184466
3592959782.6197439868214.0178772153166-496.7022445268050.434673243278042
3699469811.360306505514.2471905854922130.6732111379780.189519212212617
3797019751.4937820990613.2010167130039-30.4799533687047-0.955296321157828
3890499684.3655051630312.0932150878748-613.716658893921-1.03318116150092
39101909732.8140189327612.6213954112782447.4485736492550.46510085549231
4097069802.9946510796713.5334303953238-112.2899741402240.731760978539261
4197659921.0810820301815.3286554513203-183.6889484390681.32326995921778
4298939929.7152891841915.2076123486711-34.9521925049193-0.0846274532953867
4399949820.5747931766312.9225934420333206.216609388381-1.57492203231377
44104339843.6123694098513.1051449576991586.7095529227660.128594746605431
45100739880.1427499781713.5085258476598186.6230459362730.299105764645484
46101129964.7120289185514.6518360874417128.2802660606800.910962070429564
4792669950.6898988655714.2251414897267-676.987541670659-0.3687439599434
4898209881.3358665017313.0701928574185-38.8190975296027-1.07702120683888
49100979910.4921328930913.2808037652791182.1685879958940.207439205435006
5091159905.3767510741213.0450385086054-785.417047391779-0.237059055135468
51104119938.632240280913.3070737087724466.9305017079910.259948829123201
5296789935.92312302713.0925556965901-253.626582992084-0.205530061161791
531040810066.419187814714.7240773602836310.1643860972271.50389692829314
541015310125.660740745515.360019252428115.44162861629780.569875235783153
551036810166.002402101315.7206339303438195.3191407457440.319984469395506
561058110157.491548157915.3740444908598429.996697332405-0.310858783965662
571059710218.692954471416.011928202627366.0072595066590.589101515682277
581068010303.774591882316.9350992352333357.6400706052490.889703993818281
59973810351.256764583217.3246716653247-621.4952143015560.394172004921958
60955610221.098998751915.5262153117186-625.256179984303-1.90539595655157
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259939288pkptiqcnht5im2l/1bmhq1259939165.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259939288pkptiqcnht5im2l/1bmhq1259939165.ps (open in new window)


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


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259939288pkptiqcnht5im2l/3hya11259939165.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259939288pkptiqcnht5im2l/3hya11259939165.ps (open in new window)


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


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