R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42,75.73,55.48,43.8,45.29,44.01,47.48,51.07,57.84,69.04,65.61,72.87,68.41) > x <- c(2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.10,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.40,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.40,3857.62,3801.06,3504.37,3032.60,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41,1810.99,1670.07,1864.44,2052.02,2029.60,2070.83,2293.41,2443.27) > 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 -15.8153173 2 -21.0137729 3 -25.9252564 4 -22.3517650 5 -21.4451648 6 -14.1004335 7 -14.3150188 8 -15.3555630 9 -12.1160519 10 -10.0712467 11 -4.6110906 12 -4.9445221 13 -9.6968258 14 -13.2230192 15 -12.8636694 16 -8.0127153 17 -10.8778939 18 -10.3358768 19 -5.0036584 20 -0.4711848 21 -1.0824663 22 2.6274177 23 1.3865261 24 -9.4826282 25 -14.9095918 26 -15.9420254 27 -13.5405817 28 -22.1062684 29 -19.2306377 30 -14.5981326 31 -10.5610573 32 -11.2947485 33 -8.1287697 34 -2.7456288 35 -3.9620408 36 0.2789540 37 4.6264512 38 17.9013153 39 15.8182190 40 19.4150002 41 22.1674546 42 31.2040308 43 36.7401259 44 51.5488152 45 62.3326278 46 68.8615274 47 49.0172596 48 34.9792097 49 14.8134524 50 -4.1115589 51 -14.6959883 52 -13.5136614 53 -14.1114046 54 -9.6231496 55 -7.4376218 56 -2.0230309 57 9.3389707 58 5.6110524 59 11.2627414 60 5.7198881 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/18z511257524625.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/html/rcomp/tmp/2zuwx1257524625.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/html/rcomp/tmp/3ve0b1257524625.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/html/rcomp/tmp/4xuz71257524625.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/html/rcomp/tmp/5qx011257524625.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/html/rcomp/tmp/68qgx1257524625.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/html/rcomp/tmp/7ar6i1257524625.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/html/rcomp/tmp/8xm0h1257524625.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. 1670 2952 3499 3371 4004 4697 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/9ql5k1257524625.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/html/rcomp/tmp/10efy61257524625.tab") > > system("convert tmp/18z511257524625.ps tmp/18z511257524625.png") > system("convert tmp/2zuwx1257524625.ps tmp/2zuwx1257524625.png") > system("convert tmp/3ve0b1257524625.ps tmp/3ve0b1257524625.png") > system("convert tmp/4xuz71257524625.ps tmp/4xuz71257524625.png") > system("convert tmp/5qx011257524625.ps tmp/5qx011257524625.png") > system("convert tmp/68qgx1257524625.ps tmp/68qgx1257524625.png") > system("convert tmp/7ar6i1257524625.ps tmp/7ar6i1257524625.png") > system("convert tmp/8xm0h1257524625.ps tmp/8xm0h1257524625.png") > > > proc.time() user system elapsed 1.628 1.187 2.145