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(106.707,108.827,108.413,106.249,104.861,102.382,100.320,100.228,117.089,121.523,114.948,112.831,107.605,108.928,101.993,102.850,99.925,101.536,99.450,98.305,110.159,109.483,106.810,96.279,91.982,90.276,90.999,86.622,83.117,80.367,77.550,77.443,92.844,92.175,84.822,81.632,78.872,81.485,80.651,78.192,76.844,76.335,71.415,73.889,86.822,86.371,83.469,82.662,82.880,89.406,95.378,97.657,100.247,99.180,97.493,101.628,114.585,115.669,111.311) > x <- c(123.560,122.117,121.782,121.789,122.273,121.683,119.869,118.873,117.607,122.783,124.454,127.064,125.166,124.554,124.272,128.836,127.408,126.420,124.465,124.526,124.379,130.189,132.196,134.893,132.709,129.955,127.947,130.369,129.852,124.278,126.141,121.743,110.898,117.707,120.738,121.445,120.439,116.313,117.173,119.773,119.639,113.006,113.776,107.866,106.924,114.562,115.367,116.602,114.393,115.140,117.623,119.361,120.527,121.660,122.852,119.325,119.151,126.494,127.832) > 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.6733060 2 13.0287237 3 12.9015324 4 10.7315394 5 8.9291651 6 6.9552908 7 6.4463386 8 7.2070593 9 25.1519394 10 25.1545309 11 17.1489120 12 12.7973726 13 9.1963365 14 11.0432975 15 4.3497305 16 1.2992829 17 -0.4031415 18 2.0537302 19 1.6414944 20 0.4442695 21 12.4241229 22 6.7739182 23 2.3826345 24 -10.4573896 25 -12.8845681 26 -12.2327437 27 -9.7906038 28 -16.2411879 29 -19.3035608 30 -17.2814064 31 -21.6934053 32 -18.0350779 33 6.6508187 34 0.1523249 35 -9.7956518 36 -13.5909466 37 -15.4896643 38 -9.3442085 39 -10.9144935 40 -15.5994715 41 -16.8327480 42 -11.6629357 43 -17.2421677 44 -9.7083485 45 4.0311405 46 -2.9590979 47 -6.5502950 48 -8.4146345 49 -6.3054094 50 -0.4189500 51 3.4272411 52 4.2182604 53 5.8099949 54 3.7729822 55 1.0654569 56 8.2200816 57 21.3260509 58 16.1233754 59 10.6198529 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1p3m61256676764.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/21pag1256676764.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/3jzq71256676764.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/4x0os1256676764.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/5co1d1256676764.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/6pqwt1256676764.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/7qlp31256676764.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/8gkcu1256676764.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. 106.9 118.3 121.8 121.9 125.7 134.9 > > #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/9shjl1256676764.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/102omp1256676764.tab") > > system("convert tmp/1p3m61256676764.ps tmp/1p3m61256676764.png") > system("convert tmp/21pag1256676764.ps tmp/21pag1256676764.png") > system("convert tmp/3jzq71256676764.ps tmp/3jzq71256676764.png") > system("convert tmp/4x0os1256676764.ps tmp/4x0os1256676764.png") > system("convert tmp/5co1d1256676764.ps tmp/5co1d1256676764.png") > system("convert tmp/6pqwt1256676764.ps tmp/6pqwt1256676764.png") > system("convert tmp/7qlp31256676764.ps tmp/7qlp31256676764.png") > system("convert tmp/8gkcu1256676764.ps tmp/8gkcu1256676764.png") > > > proc.time() user system elapsed 1.810 1.570 3.202