R version 2.8.1 (2008-12-22) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > y <- c(9339.18,11846.77,11878.38538,12900.52667,14390.58636,10243.18,12688.11,11353.05667,14408.58636,11750.92385,11268.52333,12738.67727,10268.82286,13005.00077,10233.72333,10856.375,10243.23353,15511.22273,10164.5625,15585.46231,9092.821765,10735.75,10203.29235,7685.23,8440.764444,8818.966842,11098.25,12002.65667,10041.625,10702.8125,9687.762941,9273.44,8091.74,9350.545789,10759.82176,9736.264444,8417.177368,10360.76294,10038.59,9116.669048,7172.363333,7921.17,7400.41,7582.907692,9751.141818,7645.53,7749.027143,7178.991429,6063.088621,6936.706667,6580.795161,5817.088621,5735.843333,6909.641818,5792.57,6949.304783,5415.484615,5989.826522,7398.414545,8162.264444) > x <- c(8959.322857,12764.92385,12802.46231,13571.86,14240.76818,10476.96571,12874.52667,11803.59,15271.95,12292.77,11445.59,13835.04091,9870.108571,13825.61615,10885.59,10985.8125,9666.351176,14978.13182,10149.375,15264.30846,9154.41,11204.1875,10698.76294,8304.177368,8035.097778,9298.756316,11512.0625,12362.05667,9894.125,10882.125,9980.351176,9729.44,8351.44,9487.440526,11315.82176,9965.542222,8388.651053,10709.46882,10134.14,8894.192857,6502.696667,7416.29,7519.33,7274.523077,9486.823636,7591.09,7588.884286,7050.884286,5354.743793,6648.806667,6253.633871,5205.812759,5117.769259,6323.869091,5632.13,6762.13087,5454.753846,6095.913478,7350.369091,8667.653333) > par2 = '36' > par1 = '0' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > x <- as.ts(x) > y <- as.ts(y) > mylm <- lm(y~x) > cbind(mylm$resid) [,1] 1 396.669560 2 -532.228358 3 -534.510505 4 -207.141439 5 678.888852 6 -69.773988 7 210.139425 8 -157.849587 9 -234.276520 10 -201.715832 11 80.893916 12 -606.645291 13 503.865688 14 -331.811158 15 -448.221637 16 83.928320 17 662.270904 18 1133.679999 19 147.425525 20 949.499801 21 -25.853914 22 -233.891039 23 -309.946298 24 -665.678860 25 332.836590 26 -430.054707 27 -149.404609 28 -12.549425 29 254.980802 30 23.996456 31 -176.744179 32 -364.492335 33 -301.847392 34 -68.859100 35 -310.625903 36 -114.870073 37 -10.011901 38 -162.143203 39 35.210351 40 232.971516 41 448.205852 42 372.030484 43 -241.775454 44 161.784833 45 332.293986 46 -61.455304 47 44.033616 48 -40.183825 49 375.541701 50 80.610696 51 81.543363 52 264.027608 53 262.286299 54 346.967058 55 -145.458867 56 -9.123844 57 -362.372177 58 -367.002509 59 -91.197867 60 -516.866099 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1ah171257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(y,type='l',main='Run Sequence Plot of Y[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2f5up1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,type='l',main='Run Sequence Plot of X[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3xe8z1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Scatter Plot',xlab='X[t]',ylab='Y[t]') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/484hh1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mylm$resid,type='l',main='Run Sequence Plot of e[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/525gh1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mylm$resid,main='Histogram of e[t]') > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6vbnf1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if (par1 > 0) + { + densityplot(~mylm$resid,col='black',main=paste('Density Plot of e[t] bw = ',par1),bw=par1) + } else { + densityplot(~mylm$resid,col='black',main='Density Plot of e[t]') + } > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/7f92s1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mylm$resid,main='QQ plot of e[t]') > qqline(mylm$resid) > grid() > dev.off() null device 1 > if (par2 > 0) + { + postscript(file="/var/www/rcomp/tmp/8xcha1257281486.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + acf(mylm$resid,lag.max=par2,main='Residual Autocorrelation Function') + grid() + dev.off() + } null device 1 > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 5118 7494 9698 9659 11350 15270 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Model: Y[t] = c + b X[t] + e[t]',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'c',1,TRUE) > a<-table.element(a,mylm$coeff[[1]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'b',1,TRUE) > a<-table.element(a,mylm$coeff[[2]]) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/9yszz1257281486.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Descriptive Statistics about e[t]',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations',header=TRUE) > a<-table.element(a,length(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'minimum',header=TRUE) > a<-table.element(a,min(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Q1',header=TRUE) > a<-table.element(a,quantile(mylm$resid,0.25)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'median',header=TRUE) > a<-table.element(a,median(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mean',header=TRUE) > a<-table.element(a,mean(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Q3',header=TRUE) > a<-table.element(a,quantile(mylm$resid,0.75)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum',header=TRUE) > a<-table.element(a,max(mylm$resid)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/106ml21257281486.tab") > > system("convert tmp/1ah171257281486.ps tmp/1ah171257281486.png") > system("convert tmp/2f5up1257281486.ps tmp/2f5up1257281486.png") > system("convert tmp/3xe8z1257281486.ps tmp/3xe8z1257281486.png") > system("convert tmp/484hh1257281486.ps tmp/484hh1257281486.png") > system("convert tmp/525gh1257281486.ps tmp/525gh1257281486.png") > system("convert tmp/6vbnf1257281486.ps tmp/6vbnf1257281486.png") > system("convert tmp/7f92s1257281486.ps tmp/7f92s1257281486.png") > system("convert tmp/8xcha1257281486.ps tmp/8xcha1257281486.png") > > > proc.time() user system elapsed 2.05 1.77 3.50