Home » date » 2009 » Dec » 04 »

Structural time series model

*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 12:54:39 -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/t1259956546q4nqzesrcfcbbai.htm/, Retrieved Fri, 04 Dec 2009 20:55:53 +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/t1259956546q4nqzesrcfcbbai.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 «
19 18 19 19 22 23 20 14 14 14 15 11 17 16 20 24 23 20 21 19 23 23 23 23 27 26 17 24 26 24 27 27 26 24 23 23 24 17 21 19 22 22 18 16 14 12 14 16 8 3 0 5 1 1 3 6 7 8 14 14 13
 
Output produced by software:


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


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
11919000
21818.1108869988334-0.051231097300266-0.0512310975556439-0.200626530440003
31918.9004944082692-0.0398278045332988-0.03982780453329930.305317779906727
41919.0130083739769-0.0387673174784865-0.03876731747848650.0558017298893943
52221.5816274608516-0.0231613156477001-0.02316131564770020.955488215616181
62322.8048158117019-0.0159126167790224-0.01591261677902260.456747429571069
72020.4291933373491-0.0295117081831036-0.0295117081831038-0.864754732546442
81414.9787506804773-0.0605586504685541-0.0605586504685542-1.98657023864225
91414.1883374202623-0.0647146027942089-0.0647146027942088-0.267461831052249
101414.0734899979576-0.0649984508668466-0.0649984508668466-0.0183714315332262
111514.9076372112654-0.0599362284161829-0.0599362284161830.329493139930105
121111.6240202077550-0.0779840534106643-0.0779840534106638-1.18130993359118
131714.1818883581347-0.2152068074230692.367274884087871.18240948626271
141615.9234675080638-0.163118067413767-0.1631180685486670.6029756395653
152019.5104961529234-0.139743618970718-0.1397436189707191.36721031481802
162423.4378945844903-0.126594440155188-0.1265944401551881.48864076745306
172323.1537340304521-0.127034667374350-0.127034667374350-0.0576835873659201
182020.5529785008708-0.133773463631006-0.133773463631006-0.905625815193748
192121.0288148620954-0.132122767105274-0.1321227671052730.223177467762196
201919.3912991965062-0.136186099490365-0.136186099490366-0.551121555475307
212322.5661621676204-0.127273647106577-0.1272736471065771.21216611578203
222323.0261721454294-0.125697097346314-0.1256970973463140.215002437889736
232323.0926204103863-0.125182669142621-0.1251826691426210.0703435644992861
242323.1020166422713-0.124823324997941-0.1248233249979400.0492686224335875
252724.813743856618-0.1703247748374371.873572527219300.747681575636689
262625.9640351458097-0.147401698739636-0.1474017020178210.434638135554451
271718.4225733035037-0.177377590719308-0.177377590719307-2.69880043671563
282423.3088895353951-0.166710614046131-0.1667106140461291.85296511339913
292625.7243704807678-0.162004721025879-0.1620047210258790.945031693393256
302424.3667736706542-0.164131260759238-0.164131260759239-0.437569293181091
312726.7311014851556-0.159656812215594-0.1596568122155930.925380102187874
322727.0736498418047-0.158770088205344-0.1587700882053450.183799821206169
332626.2693249146466-0.159907830926560-0.159907830926559-0.23626349252131
342424.4449516761456-0.162836137744504-0.162836137744503-0.609169023074157
352323.326487029547-0.164514427257566-0.164514427257565-0.349745143263629
362323.1641427901844-0.164510622622709-0.1645106226227070.000794254146383672
372422.3996663722857-0.1547576754968721.70233443029569-0.235995945432381
381717.8555214912224-0.211281772688481-0.211281774705440-1.48747864115771
392120.6885603225443-0.202136810370800-0.2021368103707981.11177867158714
401919.3896836800057-0.203850179065471-0.203850179065470-0.401286596692104
412221.7634623739253-0.200364583841613-0.2003645838416140.943223462991855
422222.1073863965383-0.199645920035348-0.1996459200353480.199171826098259
431818.7406488578405-0.203808368649554-0.203808368649553-1.15893662772088
441616.5441890055514-0.206422580280858-0.206422580280858-0.729172455501753
451414.5173749489054-0.208807504442529-0.208807504442529-0.666136864396173
461212.5151493740287-0.211153992432317-0.211153992432317-0.656266102712891
471413.9329137669097-0.209025521960652-0.2090255219606520.596070339424432
481615.8464655201049-0.206255618643653-0.2062556186436510.776714571134126
4988.03514433471271-0.1142628517014171.25689137184811-2.93909960858519
5033.78323541200469-0.156613578762039-0.156613583824149-1.42555589150619
5100.663991842963106-0.163682187017350-0.163682187017348-1.08229674760542
5254.48370083080553-0.158736990329350-0.1587369903293481.45738813912598
5311.62013270355226-0.161644462252316-0.161644462252317-0.98968450708988
5411.20489755816989-0.161910699284411-0.161910699284411-0.0927883578614771
5532.85316816971688-0.160018502727007-0.1600185027270070.662342510925763
5665.65487429964198-0.156927305944377-0.1569273059443781.08369020628696
5776.91520497503423-0.155449737473623-0.1554497374736230.518572207386821
5887.95209064425682-0.154207970164030-0.154207970164030.436273277376316
591413.2280670938837-0.148558552781648-0.1485585527816481.98689353198937
601413.9927947018899-0.147609382190291-0.1476093821902920.334169445813131
611311.9099693457891-0.1289700200934681.41867022554141-0.739898804466961
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259956546q4nqzesrcfcbbai/17zo21259956476.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259956546q4nqzesrcfcbbai/17zo21259956476.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259956546q4nqzesrcfcbbai/27ayp1259956476.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259956546q4nqzesrcfcbbai/27ayp1259956476.ps (open in new window)


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


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259956546q4nqzesrcfcbbai/42ufj1259956476.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259956546q4nqzesrcfcbbai/42ufj1259956476.ps (open in new window)


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