Home » date » 2009 » Dec » 04 »

WS 9: Classical decomposition

*The author of this computation has been verified*
R Software Module: /rwasp_decompose.wasp (opens new window with default values)
Title produced by software: Classical Decomposition
Date of computation: Fri, 04 Dec 2009 10:04:38 -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/t1259946332p8cbgy7ceexa71m.htm/, Retrieved Fri, 04 Dec 2009 18:05:38 +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/t1259946332p8cbgy7ceexa71m.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


Classical Decomposition by Moving Averages
tObservationsFitTrendSeasonalRandom
1114NANA0.843779814346342NA
2116NANA0.855017455922698NA
3153NANA1.13107889507666NA
4162NANA1.18536690842222NA
5161NANA1.165407606338NA
6149NANA1.07828248182023NA
7139138.047772217922135.3333333333331.020057430181691.00689781346543
8135133.973445021165135.1250.9914778539956681.00766237651553
9130131.680439553382134.8333333333330.976616362571440.98723850285523
10127127.958221623648134.4583333333330.951657055769310.992511449350502
11122122.088734995083134.0833333333330.9105437041274050.99927319260793
12117119.207281406160133.8333333333330.8907144314283450.981483669620486
13112112.785235184294133.6666666666670.8437798143463420.993037783864074
14113114.10920463835133.4583333333330.8550174559226980.990279446413938
15149150.57487790708133.1251.131078895076660.989540898661383
16157157.357457093049132.751.185366908422220.997728375256865
17157154.270831888993132.3751.1654076063381.01769075902158
18147142.378216037012132.0416666666671.078282481820231.03246131389781
19137134.520073605210131.8751.020057430181691.01843536305271
20132130.668518841179131.7916666666670.9914778539956681.01018976238982
21125128.465744026585131.5416666666670.976616362571440.973022037486759
22123124.706726683103131.0416666666670.951657055769310.986314076806456
23117118.750074746616130.4166666666670.9105437041274050.985262537725976
24114115.384631971280129.5416666666670.8907144314283450.987999857973938
25111108.355391158976128.4166666666670.8437798143463421.02440680443065
26112108.729719811503127.1666666666670.8550174559226981.03007715088539
27144142.704453928838126.1666666666671.131078895076661.00907852583079
28150148.565985855585125.3333333333331.185366908422221.00965237188147
29149144.899012388025124.3333333333331.1654076063381.02830238484299
30134132.988172757828123.3333333333331.078282481820231.00760840021477
31123124.617016053863122.1666666666671.020057430181690.98702411512434
32116119.679639292727120.7083333333330.9914778539956680.96925425816394
33117116.298731842882119.0833333333330.976616362571441.00602988653449
34111111.740399298246117.4166666666670.951657055769310.993373933663238
35105105.205737147721115.5416666666670.9105437041274050.998044430339082
36102101.281653473665113.7083333333330.8907144314283451.00709256318097
379594.6791266681124112.2083333333330.8437798143463421.00338906095968
389394.9425633347495111.0416666666670.8550174559226980.97953959460837
39124124.512935033022110.0833333333331.131078895076660.995880467897684
40130129.402554169425109.1666666666671.185366908422221.00461695547209
41124126.252490686617108.3333333333331.1654076063380.982158841585092
42115115.960295232417107.5416666666671.078282481820230.991718758300053
43106108.848628278971106.7083333333331.020057430181690.973829451744028
44105105.0966525235411060.9914778539956680.999080346317223
45105102.951641554406105.4166666666670.976616362571441.01989631651003
4610199.6067718371877104.6666666666670.951657055769311.01398728356632
479594.6586059082449103.9583333333330.9105437041274051.00360658271353
489392.1147174502147103.4166666666670.8907144314283451.00961065261112
498487.0147933544665103.1250.8437798143463420.965353094132106
508788.2093008693583103.1666666666670.8550174559226980.986290551478814
51116116.972409065844103.4166666666671.131078895076660.991686850996657
52120123.179377900209103.9166666666671.185366908422220.97418904077609
53117122.125005414170104.7916666666671.1654076063380.958034757936846
54109114.208086199459105.9166666666671.078282481820230.954398270973884
55105NANA1.02005743018169NA
56107NANA0.991477853995668NA
57109NANA0.97661636257144NA
58109NANA0.95165705576931NA
59108NANA0.910543704127405NA
60107NANA0.890714431428345NA
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259946332p8cbgy7ceexa71m/1h9541259946276.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259946332p8cbgy7ceexa71m/1h9541259946276.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259946332p8cbgy7ceexa71m/20i2e1259946276.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259946332p8cbgy7ceexa71m/20i2e1259946276.ps (open in new window)


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


http://www.freestatistics.org/blog/date/2009/Dec/04/t1259946332p8cbgy7ceexa71m/40io31259946276.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/04/t1259946332p8cbgy7ceexa71m/40io31259946276.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 = multiplicative ; par2 = 12 ; par3 = 1 ; par4 = 1 ; par5 = 12 ; par6 = 3 ; par7 = 1 ; par8 = 2 ; par9 = 1 ;
 
R code (references can be found in the software module):
par2 <- as.numeric(par2)
x <- ts(x,freq=par2)
m <- decompose(x,type=par1)
m$figure
bitmap(file='test1.png')
plot(m)
dev.off()
mylagmax <- length(x)/2
bitmap(file='test2.png')
op <- par(mfrow = c(2,2))
acf(as.numeric(x),lag.max = mylagmax,main='Observed')
acf(as.numeric(m$trend),na.action=na.pass,lag.max = mylagmax,main='Trend')
acf(as.numeric(m$seasonal),na.action=na.pass,lag.max = mylagmax,main='Seasonal')
acf(as.numeric(m$random),na.action=na.pass,lag.max = mylagmax,main='Random')
par(op)
dev.off()
bitmap(file='test3.png')
op <- par(mfrow = c(2,2))
spectrum(as.numeric(x),main='Observed')
spectrum(as.numeric(m$trend[!is.na(m$trend)]),main='Trend')
spectrum(as.numeric(m$seasonal[!is.na(m$seasonal)]),main='Seasonal')
spectrum(as.numeric(m$random[!is.na(m$random)]),main='Random')
par(op)
dev.off()
bitmap(file='test4.png')
op <- par(mfrow = c(2,2))
cpgram(as.numeric(x),main='Observed')
cpgram(as.numeric(m$trend[!is.na(m$trend)]),main='Trend')
cpgram(as.numeric(m$seasonal[!is.na(m$seasonal)]),main='Seasonal')
cpgram(as.numeric(m$random[!is.na(m$random)]),main='Random')
par(op)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Classical Decomposition by Moving Averages',6,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'t',header=TRUE)
a<-table.element(a,'Observations',header=TRUE)
a<-table.element(a,'Fit',header=TRUE)
a<-table.element(a,'Trend',header=TRUE)
a<-table.element(a,'Seasonal',header=TRUE)
a<-table.element(a,'Random',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(m$trend)) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,x[i])
if (par1 == 'additive') a<-table.element(a,m$trend[i]+m$seasonal[i]) else a<-table.element(a,m$trend[i]*m$seasonal[i])
a<-table.element(a,m$trend[i])
a<-table.element(a,m$seasonal[i])
a<-table.element(a,m$random[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