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(10898,11078,11157,11203,11425,11368,11118,11041,10837,11018,11035,11220,11486,11553,11626,11861,11951,11935,11717,11841,11701,11842,11818,12088,11876,11839,11582,11848,11741,11455,11154,10922,10556,10923,11001,10702,10805,10831,10925,11220,11188,10752,10771,10274,10261,10600,10596,10556,10716,10958,11273,11806,11922,12127,11985,11805,11901,12217,12344,12314) > x <- c(2534,2605,2682,2755,2760,2735,2659,2654,2670,2785,2845,2723,2746,2767,2940,2977,2993,2892,2824,2771,2686,2738,2723,2731,2632,2606,2605,2646,2627,2535,2456,2404,2319,2519,2504,2382,2394,2381,2501,2532,2515,2429,2389,2261,2272,2439,2373,2327,2364,2388,2553,2663,2694,2679,2611,2580,2627,2732,2707,2633) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = '' > par2 = '36' > par1 = '0' > ylab = '' > xlab = '' > main = '' > #'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 -283.44723 2 -258.38810 3 -347.42256 4 -460.72796 5 -249.63929 6 -252.08264 7 -336.23045 8 -402.31912 9 -641.23537 10 -711.19593 11 -825.13187 12 -373.89545 13 -158.08757 14 -136.91515 15 -441.44712 16 -287.19095 17 -232.10720 18 -27.69836 19 -97.30429 20 142.35579 21 187.84838 22 215.37056 23 224.10455 24 476.64642 25 480.69073 26 500.42964 27 245.61190 28 422.13901 29 356.60206 30 271.37051 31 142.76950 32 24.24732 33 -156.26009 34 -225.71324 35 -114.97926 36 -147.74284 37 -70.93002 38 -16.56057 39 -184.43246 40 42.91730 41 48.01582 42 -200.30933 43 -94.01870 44 -311.68868 45 -348.69360 46 -374.13198 47 -234.10244 48 -173.71822 49 -94.46205 50 95.16357 51 50.08972 52 343.04049 53 391.39025 54 629.12424 55 635.51831 56 523.16855 57 516.60206 58 603.46415 59 785.02080 60 916.50846 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1an3o1257331858.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/2t31k1257331858.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/3t0hp1257331858.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/4o3sm1257331858.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/55pya1257331858.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/6bgas1257331858.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/7n85e1257331858.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/8cutj1257331858.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. 2261 2490 2630 2608 2731 2993 > > #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/945av1257331858.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/101seu1257331858.tab") > > system("convert tmp/1an3o1257331858.ps tmp/1an3o1257331858.png") > system("convert tmp/2t31k1257331858.ps tmp/2t31k1257331858.png") > system("convert tmp/3t0hp1257331858.ps tmp/3t0hp1257331858.png") > system("convert tmp/4o3sm1257331858.ps tmp/4o3sm1257331858.png") > system("convert tmp/55pya1257331858.ps tmp/55pya1257331858.png") > system("convert tmp/6bgas1257331858.ps tmp/6bgas1257331858.png") > system("convert tmp/7n85e1257331858.ps tmp/7n85e1257331858.png") > system("convert tmp/8cutj1257331858.ps tmp/8cutj1257331858.png") > > > proc.time() user system elapsed 1.584 1.164 2.006