R version 2.8.0 (2008-10-20) 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(89.3,90.3,91.1,90.1,86.7,85.1,83.4,82,80.4,81.9,93.8,94.8,92.3,87.5,83.2,82,80.3,81.8,85.1,84.2,84.4,84.5,93.3,93.2,100.3,111.4,114.9,109.5,109.9,105.8,110.8,108.8,116.1,109.8,113.8,113.8,117.4,119.5,122.6,120.7,119,126.1,133.9,138.1,140.4,148.2,148.2,155.9,171.1,171.9,188.8,214.9,228.5,220,225.4,220.7,219.7,232.1,223.5,218.9) > x <- c(84,84.5,87.3,86.3,85,86.5,85.4,81.2,81.5,82.2,86.4,86.9,88.6,91.6,89.7,85.9,89.8,91.4,93.1,95.1,94.9,101.2,105.6,112.2,119.7,128.2,129.6,129.9,121.7,125.7,130.4,128.5,130,136.7,138.1,139.5,140.4,144.6,151.4,147.9,141.5,143.8,143.6,150.5,150.1,154.9,162.1,176.7,186.6,194.8,196.3,228.8,267.2,237.2,254.7,258.2,257.9,269.6,266.9,269.6) > 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 9.5661518 2 10.1585264 3 8.6758241 4 8.4910749 5 6.1509010 6 3.3280248 7 2.5248007 8 4.5488540 9 2.7042788 10 3.6336032 11 12.1095499 12 12.7019245 13 8.8159981 14 1.5702457 15 -1.1807778 16 0.7171753 17 -4.1623029 18 -3.9667041 19 -2.0526305 20 -4.5831321 21 -4.2200820 22 -9.2561620 23 -4.0432656 24 -9.5239209 25 -8.5383019 26 -4.3679337 27 -2.0092848 28 -7.6538601 29 -0.5688035 30 -7.9298067 31 -6.7614855 32 -7.2125090 33 -1.1353852 34 -12.8975656 35 -10.0389167 36 -11.1802678 37 -8.3139935 38 -9.6380469 39 -12.0817524 40 -11.1283746 41 -7.6107694 42 -2.3858463 43 5.5772039 44 4.1519734 45 6.7780737 46 10.6648698 47 4.7950640 48 0.5924023 49 7.7214193 50 1.8363628 51 17.5134866 52 17.1178354 53 -0.5877954 54 15.3697287 55 6.5028396 56 -1.0505382 57 -1.8059630 58 1.0556026 59 -5.3432202 60 -12.1443974 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1c2le1256827064.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/freestat/rcomp/tmp/2xiri1256827064.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/freestat/rcomp/tmp/3mp6u1256827064.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/freestat/rcomp/tmp/40f5r1256827064.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/freestat/rcomp/tmp/55wv11256827064.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/freestat/rcomp/tmp/6jrbc1256827064.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/freestat/rcomp/tmp/74jdf1256827064.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/freestat/rcomp/tmp/8ek9n1256827064.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. 81.20 89.78 129.80 140.20 152.30 269.60 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9jnhb1256827064.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/freestat/rcomp/tmp/10onzg1256827064.tab") > > system("convert tmp/1c2le1256827064.ps tmp/1c2le1256827064.png") > system("convert tmp/2xiri1256827064.ps tmp/2xiri1256827064.png") > system("convert tmp/3mp6u1256827064.ps tmp/3mp6u1256827064.png") > system("convert tmp/40f5r1256827064.ps tmp/40f5r1256827064.png") > system("convert tmp/55wv11256827064.ps tmp/55wv11256827064.png") > system("convert tmp/6jrbc1256827064.ps tmp/6jrbc1256827064.png") > system("convert tmp/74jdf1256827064.ps tmp/74jdf1256827064.png") > system("convert tmp/8ek9n1256827064.ps tmp/8ek9n1256827064.png") > > > proc.time() user system elapsed 2.475 1.860 2.913