Home » date » 2009 » Dec » 05 »

WS 8: 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: Fri, 04 Dec 2009 16:42:15 -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/05/t1259970196mkwnowtfzo5zafg.htm/, Retrieved Sat, 05 Dec 2009 00:43:21 +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/05/t1259970196mkwnowtfzo5zafg.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 «
114 116 153 162 161 149 139 135 130 127 122 117 112 113 149 157 157 147 137 132 125 123 117 114 111 112 144 150 149 134 123 116 117 111 105 102 95 93 124 130 124 115 106 105 105 101 95 93 84 87 116 120 117 109 105 107 109 109 108 107
 
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


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


Seasonal Decomposition by Loess - Time Series Components
tObservedFittedSeasonalTrendRemainder
1114109.720309703983-19.3970127345763137.676703030593-4.27969029601698
2116112.533551380647-17.8638486340743137.330297253427-3.46644861935286
3153153.34679201169815.6693165120408136.9838914762610.346792011698113
4162164.90774174676522.4923991100738136.5998591431622.9077417467646
5161165.26869148183120.5154817081073136.2158268100624.26869148183076
6149152.2336591130089.92150769545727135.8448331915353.23365911300797
7139141.1986272669911.32753316000100135.4738395730082.19862726699145
8135136.304999336799-1.4261051936516135.1211058568531.30499933679857
9130128.211369184676-2.97974132537437134.768372140699-1.78863081532415
10127125.329916910628-5.6244654229042134.294548512276-1.6700830893719
11122120.24846463658-10.0691895204337133.820724883854-1.75153536341998
12117112.974613841730-12.5658710169265133.591257175197-4.02538615827041
13112110.035223268036-19.3970127345763133.361789466540-1.96477673196389
14113110.609954078629-17.8638486340743133.253894555445-2.39004592137107
15149149.18468384360915.6693165120408133.1459996443510.184683843608582
16157158.55531733336822.4923991100738132.9522835565581.55531733336824
17157160.72595082312820.5154817081073132.7585674687653.72595082312750
18147151.6121856098549.92150769545727132.4663066946894.61218560985395
19137140.4984209193871.32753316000100132.1740459206123.49842091938669
20132133.668285991863-1.4261051936516131.7578192017891.66828599186280
21125121.638148842409-2.97974132537437131.341592482965-3.36185115759092
22123120.920849227245-5.6244654229042130.703616195659-2.07915077275521
23117114.003549612080-10.0691895204337130.065639908354-2.99645038791986
24114111.349207036767-12.5658710169265129.216663980160-2.65079296323302
25111113.029324682611-19.3970127345763128.3676880519662.02932468261073
26112114.414070889012-17.8638486340743127.4497777450622.41407088901212
27144145.79881604980015.6693165120408126.5318674381591.79881604980032
28150151.97649581276822.4923991100738125.5311050771581.97649581276832
29149152.95417557573620.5154817081073124.5303427161573.95417557573597
30134134.7899157693599.92150769545727123.2885765351840.789915769358956
31123122.6256564857881.32753316000100122.046810354211-0.374343514211773
32116112.919366689641-1.4261051936516120.506738504010-3.08063331035858
33117118.013074671565-2.97974132537437118.9666666538101.01307467156481
34111110.352329742067-5.6244654229042117.272135680837-0.647670257932603
35105104.491584812570-10.0691895204337115.577604707864-0.508415187430373
36102102.574831906704-12.5658710169265113.9910391102230.574831906703523
379596.9925392219944-19.3970127345763112.4044735125821.99253922199436
389392.6888084609467-17.8638486340743111.175040173128-0.31119153905334
39124122.38507665428615.6693165120408109.945606833673-1.61492334571422
40130128.50189523723122.4923991100738109.005705652695-1.49810476276861
41124119.41871382017720.5154817081073108.065804471716-4.58128617982334
42115112.7403344876219.92150769545727107.338157816922-2.25966551237931
43106104.0619556778711.32753316000100106.610511162128-1.93804432212899
44105105.398095581564-1.4261051936516106.0280096120880.398095581563851
45105107.534233263327-2.97974132537437105.4455080620472.53423326332688
46101102.748566025699-5.6244654229042104.8758993972051.74856602569903
479595.7628987880708-10.0691895204337104.3062907323630.762898788070814
489394.7546195687203-12.5658710169265103.8112514482061.75461956872027
498484.0808005705267-19.3970127345763103.3162121640500.0808005705266623
508788.6406274181474-17.8638486340743103.2232212159271.64062741814742
51116113.20045322015515.6693165120408103.130230267804-2.79954677984499
52120113.24156129276522.4923991100738104.266039597162-6.75843870723543
53117108.08266936537420.5154817081073105.401848926519-8.91733063462624
54109101.4600909582379.92150769545727106.618401346306-7.53990904176321
55105100.8375130739061.32753316000100107.834953766093-4.16248692609389
56107106.272630461781-1.4261051936516109.153474731871-0.727369538219307
57109110.507745627725-2.97974132537437110.4719956976491.50774562772547
58109111.664838159360-5.6244654229042111.9596272635452.66483815935956
59108112.621930690993-10.0691895204337113.4472588294404.62193069099330
60107111.494915331029-12.5658710169265115.0709556858984.49491533102891
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/1xlqs1259970133.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/1xlqs1259970133.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/2avzx1259970133.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/2avzx1259970133.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/33lhi1259970133.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/33lhi1259970133.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/45osk1259970133.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/05/t1259970196mkwnowtfzo5zafg/45osk1259970133.ps (open in new window)


 
Parameters (Session):
par1 = FALSE ; par2 = -0.5 ; par3 = 1 ; par4 = 1 ; par5 = 12 ; par6 = 3 ; par7 = 1 ; par8 = 2 ; par9 = 1 ;
 
Parameters (R input):
par1 = 12 ; par2 = periodic ; par3 = 0 ; par5 = 1 ; par7 = 1 ; par8 = FALSE ; par9 = 1 ;
 
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