Home » date » 2009 » Dec » 02 »

Workshp 9: Decomposition by Loess

*The author of this computation has been verified*
R Software Module: /rwasp_decomposeloess.wasp (opens new window with default values)
Title produced by software: Decomposition by Loess
Date of computation: Wed, 02 Dec 2009 10:44:22 -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/02/t1259775931fpnu8hg3w3ij8pb.htm/, Retrieved Wed, 02 Dec 2009 18:45:36 +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/02/t1259775931fpnu8hg3w3ij8pb.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 «
8.1 7.7 7.5 7.6 7.8 7.8 7.8 7.5 7.5 7.1 7.5 7.5 7.6 7.7 7.7 7.9 8.1 8.2 8.2 8.2 7.9 7.3 6.9 6.6 6.7 6.9 7.0 7.1 7.2 7.1 6.9 7.0 6.8 6.4 6.7 6.6 6.4 6.3 6.2 6.5 6.8 6.8 6.4 6.1 5.8 6.1 7.2 7.3 6.9 6.1 5.8 6.2 7.1 7.7 7.9 7.7 7.4 7.5 8.0 8.1
 
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


Seasonal Decomposition by Loess - Parameters
ComponentWindowDegreeJump
Seasonal601061
Trend1912
Low-pass1312


Seasonal Decomposition by Loess - Time Series Components
tObservedFittedSeasonalTrendRemainder
18.18.39216057270666-0.02917188794757417.837011315240910.292160572706662
27.77.82521439428966-0.223997170322377.798782776032710.125214394289662
37.57.55826843806555-0.318822674890057.76055423682450.0582684380655456
47.67.57413420218201-0.1028032632727077.7286690610907-0.0258657978179864
57.87.670000123140510.2332159915026047.69678388535688-0.129999876859487
67.87.581942264020270.3480069832216387.6700507527581-0.218057735979730
77.87.693884391829840.2627979880108597.6433176201593-0.106115608170161
87.57.253877916650980.1254029769953657.62071910635365-0.246122083349017
97.57.49387161138435-0.09199220393234827.598120592548-0.00612838861565379
107.16.88935952260179-0.2968864071521347.60752688455035-0.210640477398213
117.57.30484743381920.07821938962810487.61693317655269-0.195152566180796
127.57.32689465150110.01603077417320487.6570745743257-0.173105348498900
137.67.53195591584887-0.02917188794757417.6972159720987-0.0680440841511283
147.77.8840215752723-0.223997170322377.739975595050080.184021575272292
157.77.9360874568886-0.318822674890057.782735218001450.236087456888597
167.98.11167980251511-0.1028032632727077.79112346075760.211679802515111
178.18.167272304983660.2332159915026047.799511703513740.067272304983657
188.28.304452895273140.3480069832216387.747540121505220.104452895273143
198.28.441633472492440.2627979880108597.69556853949670.24163347249244
208.28.66168356051390.1254029769953657.612913462490730.461683560513908
217.98.3617338184476-0.09199220393234827.530258385484750.461733818447595
227.37.45205997128563-0.2968864071521347.44482643586650.152059971285635
236.96.362386124123650.07821938962810487.35939448624824-0.537613875876348
246.65.917165406422970.01603077417320487.26680381940382-0.682834593577025
256.76.25495873538818-0.02917188794757417.1742131525594-0.445041264611825
266.96.93439479212987-0.223997170322377.08960237819250.0343947921298744
2777.31383107106446-0.318822674890057.004991603825590.313831071064456
287.17.34709479024488-0.1028032632727076.955708473027830.247094790244879
297.27.260358666267330.2332159915026046.906425342230060.0603586662673328
307.16.976321897473020.3480069832216386.87567111930534-0.123678102526981
316.96.692285115608520.2627979880108596.84491689638062-0.20771488439148
3277.07572233552820.1254029769953656.798874687476440.0757223355281988
336.86.9391597253601-0.09199220393234826.752832478572250.139159725360098
346.46.38964742472681-0.2968864071521346.70723898242532-0.0103525752731874
356.76.66013512409350.07821938962810486.66164548627839-0.0398648759064972
366.66.562272173295950.01603077417320486.62169705253084-0.0377278267040477
376.46.24742326916428-0.02917188794757416.5817486187833-0.152576730835720
386.36.29327420673292-0.223997170322376.53072296358945-0.00672579326707545
396.26.23912536649445-0.318822674890056.47969730839560.0391253664944538
406.56.64939052511698-0.1028032632727076.453412738155730.149390525116978
416.86.939655840581530.2332159915026046.427128167915860.139655840581533
426.86.80799520087130.3480069832216386.443997815907060.00799520087129935
436.46.076334548090880.2627979880108596.46086746389826-0.323665451909119
446.15.600671100810690.1254029769953656.47392592219395-0.499328899189314
455.85.20500782344271-0.09199220393234826.48698438048964-0.594992176557288
466.15.99765105251483-0.2968864071521346.4992353546373-0.102348947485171
477.27.810294281586920.07821938962810486.511486328784970.610294281586923
487.38.008514211598350.01603077417320486.575455014228440.708514211598355
496.97.18974818827567-0.02917188794757416.639423699671910.289748188275666
506.15.67943680570701-0.223997170322376.74456036461536-0.420563194292987
515.85.06912564533124-0.318822674890056.8496970295588-0.730874354668757
526.25.53272045282779-0.1028032632727076.97008281044491-0.667279547172207
537.16.876315417166370.2332159915026047.09046859133102-0.223684582833626
547.77.839651384527150.3480069832216387.212341632251220.139651384527146
557.98.202987338817730.2627979880108597.334214673171410.302987338817731
567.77.811265052410670.1254029769953657.463331970593960.111265052410672
577.47.29954293591583-0.09199220393234827.59244926801652-0.100457064084168
587.57.5686845585445-0.2968864071521347.728201848607630.0686845585445051
5988.057826181173150.07821938962810487.863954429198740.0578261811731533
608.18.18031195601730.01603077417320488.00365726980950.0803119560172956
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/1hphc1259775859.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/1hphc1259775859.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/2npf11259775859.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/2npf11259775859.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/30mzq1259775859.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/30mzq1259775859.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/4cpz01259775859.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/02/t1259775931fpnu8hg3w3ij8pb/4cpz01259775859.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) #seasonal period
if (par2 != 'periodic') par2 <- as.numeric(par2) #s.window
par3 <- as.numeric(par3) #s.degree
if (par4 == '') par4 <- NULL else par4 <- as.numeric(par4)#t.window
par5 <- as.numeric(par5)#t.degree
if (par6 != '') par6 <- as.numeric(par6)#l.window
par7 <- as.numeric(par7)#l.degree
if (par8 == 'FALSE') par8 <- FALSE else par9 <- TRUE #robust
nx <- length(x)
x <- ts(x,frequency=par1)
if (par6 != '') {
m <- stl(x,s.window=par2, s.degree=par3, t.window=par4, t.degre=par5, l.window=par6, l.degree=par7, robust=par8)
} else {
m <- stl(x,s.window=par2, s.degree=par3, t.window=par4, t.degre=par5, l.degree=par7, robust=par8)
}
m$time.series
m$win
m$deg
m$jump
m$inner
m$outer
bitmap(file='test1.png')
plot(m,main=main)
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(as.numeric(m$time.series[,'trend']),na.action=na.pass,lag.max = mylagmax,main='Trend')
acf(as.numeric(m$time.series[,'seasonal']),na.action=na.pass,lag.max = mylagmax,main='Seasonal')
acf(as.numeric(m$time.series[,'remainder']),na.action=na.pass,lag.max = mylagmax,main='Remainder')
par(op)
dev.off()
bitmap(file='test3.png')
op <- par(mfrow = c(2,2))
spectrum(as.numeric(x),main='Observed')
spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'trend']),'trend']),main='Trend')
spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'seasonal']),'seasonal']),main='Seasonal')
spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'remainder']),'remainder']),main='Remainder')
par(op)
dev.off()
bitmap(file='test4.png')
op <- par(mfrow = c(2,2))
cpgram(as.numeric(x),main='Observed')
cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'trend']),'trend']),main='Trend')
cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'seasonal']),'seasonal']),main='Seasonal')
cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'remainder']),'remainder']),main='Remainder')
par(op)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Seasonal Decomposition by Loess - Parameters',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Component',header=TRUE)
a<-table.element(a,'Window',header=TRUE)
a<-table.element(a,'Degree',header=TRUE)
a<-table.element(a,'Jump',header=TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Seasonal',header=TRUE)
a<-table.element(a,m$win['s'])
a<-table.element(a,m$deg['s'])
a<-table.element(a,m$jump['s'])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Trend',header=TRUE)
a<-table.element(a,m$win['t'])
a<-table.element(a,m$deg['t'])
a<-table.element(a,m$jump['t'])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Low-pass',header=TRUE)
a<-table.element(a,m$win['l'])
a<-table.element(a,m$deg['l'])
a<-table.element(a,m$jump['l'])
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Seasonal Decomposition by Loess - Time Series Components',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,'Fitted',header=TRUE)
a<-table.element(a,'Seasonal',header=TRUE)
a<-table.element(a,'Trend',header=TRUE)
a<-table.element(a,'Remainder',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,x[i]+m$time.series[i,'remainder'])
a<-table.element(a,m$time.series[i,'seasonal'])
a<-table.element(a,m$time.series[i,'trend'])
a<-table.element(a,m$time.series[i,'remainder'])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.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