Home » date » 2010 » Dec » 29 »

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: Wed, 29 Dec 2010 18:14:33 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg.htm/, Retrieved Wed, 29 Dec 2010 19:13:03 +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/2010/Dec/29/t1293646379ys8asd0zlvjt3xg.htm/},
    year = {2010},
}
@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 = {2010},
    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 «
16 17 23 24 27 31 40 47 43 60 64 65 65 55 57 57 57 65 69 70 71 71 73 68 65 57 41 21 21 17 9 11 6 -2 0 5 3 7 4 8 9 14 12 12 7 15 14 19 39 12 11 17 16 25 24 28 25 31 24 24
 
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' @ www.wessa.org


Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
11616000
21716.81890411965430.09120761858065690.04804036218671260.117992263574249
32321.57514780450961.025992817843520.115386030936390.909848580676293
42423.61940426128751.287192751888990.1171194125269210.188105422110507
52726.49736739649881.73753095304660.1153549846243360.282991191503654
63130.38000477222482.370284198742440.112430834393110.375132627188318
74038.5403687150944.108492044669020.1062103060340561.00535608939563
84746.09494163438315.150936036753480.103609761964540.596636938761412
94344.46639777399433.093259271442790.107054102086662-1.17244837068779
106057.57397105818686.137293491166150.1036879652035311.73116925896938
116463.86151287540616.182995161068350.1036548006156450.0259698778553742
126565.86466264058414.911192544037980.104258694594049-0.722449482914933
136568.1391493975874.14661781976435-2.55830288271316-0.530410140956923
145557.5451793700634-0.114004135155964-0.141234495521304-2.09916133299504
155757.1964219408155-0.184868926136985-0.142301638816791-0.0405202187611567
165757.1177682356777-0.152518332986102-0.1423695281913140.0183457137820035
175757.1092747757382-0.108654699718851-0.1425785572000220.0248437530770836
186563.61955354755881.90581574295869-0.150821369580171.14216042302572
196968.47142595090222.80220113563265-0.1534700025654390.508656249576685
207070.36368092494282.5253421825755-0.152913281285965-0.157173209799402
217171.4790317020852.09631308653295-0.152339942262533-0.243609811216449
227171.60777840411411.49758031723914-0.151813516278726-0.340000792342195
237373.1430780492461.50905910396626-0.1518201275733230.00651868068407722
246869.3744835495099-0.0971211170214097-0.151215285885445-0.91214779112687
256565.2919885711796-1.282391072219110.608828631088303-0.748299318746499
265758.22915268166-2.98265052330271-0.152620059753036-0.885066327473196
274143.8248388009016-6.44028247467356-0.186649890230214-1.97244702926666
282124.2289479034855-10.4462776800871-0.181046398014057-2.272830217249
292119.795307133977-8.61546673875535-0.1868131299557351.03788164914021
301716.0608539691079-7.12989700995922-0.1908270426340250.842750395790024
3199.14205855758652-7.06565853006861-0.1909523318914950.0364621280715375
32119.47887055140683-4.81311589615717-0.193941634951841.27892718998514
3365.90670233125862-4.43548478216535-0.1942746607049120.214436585222105
34-2-1.18952893172386-5.2452138956526-0.193804858334996-0.459829256519875
350-1.05296855994787-3.60734000719007-0.1944273535068940.930140250807293
3653.34050644059383-1.17231576352817-0.1950324338724191.38285309273212
3731.23239427867053-1.452816257129561.98094158300677-0.171234749324379
3875.894214818483560.361468866114299-0.1030658910576540.967507279110624
3944.51042887305639-0.167596486403253-0.106938319913765-0.301465234863315
4087.399610711182440.763109439668594-0.1079086111346710.528172740598879
4198.93065899396010.996917553368051-0.1084576338185030.132605186292304
421413.32399154025872.03064954488711-0.1105397330665090.586588661427802
431212.71977490227121.22881149074013-0.109374008098244-0.455189122175689
441212.45501479193130.774296060044767-0.108924413360004-0.258076102779455
4578.25966973152868-0.738084218890249-0.107930291588654-0.858822925557773
461513.68111008209321.13647661048924-0.1087409545893651.06453842257497
471414.24208603136970.961325808988462-0.108691337458263-0.0994677355647124
481918.3739494361121.92628668104321-0.1088700614588320.548003542704071
493933.16527851108155.797479942539692.889426887063792.32245707002914
501216.9804615567605-0.758747847409714-0.483924526763226-3.54431638502212
511112.3794930158989-1.92445380156352-0.490716145837041-0.663775662082355
521716.1682247915084-0.185065311944782-0.4921613632226220.987241996228739
531616.3966410167668-0.0591837925492021-0.4923969845318230.0714133994709363
542523.77360768401262.2040939785777-0.4960306016826091.28450183974847
552424.77440222602011.83789570724547-0.495606258250371-0.207900833698034
562828.14157987140232.30329502351782-0.4959731865556130.264265555816127
572526.4266270757541.08041014358021-0.495332504045457-0.69444049401996
583130.7451355543092.06589949796219-0.4956721837605530.559650229594412
592426.06004329270720.0112364730245047-0.495208271144148-1.16684177434916
602424.7917462124555-0.37819681453236-0.495150782514451-0.221160351795789
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/1x6ib1293646471.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/1x6ib1293646471.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/2pxiw1293646471.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/2pxiw1293646471.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/3pxiw1293646471.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/3pxiw1293646471.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/40ohh1293646471.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/40ohh1293646471.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/5tygk1293646471.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/29/t1293646379ys8asd0zlvjt3xg/5tygk1293646471.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
bitmap(file='test1.png')
plot(as.numeric(m$resid),main='Standardized Residuals',ylab='Residuals',xlab='time')
grid()
dev.off()
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='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