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(111.632,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,128.780) > 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 13.7127318 2 10.6827501 3 13.2426885 4 12.8194958 5 10.0198833 6 9.4067002 7 9.3099338 8 8.5559298 9 10.1265030 10 20.1901263 11 22.4296872 12 12.4271074 13 12.8026540 14 8.3803623 15 10.0736986 16 -2.8549698 17 -0.1226502 18 -1.7501602 19 2.4282415 20 0.2621333 21 -0.6898191 22 3.5342044 23 0.2225137 24 -5.9923188 25 -13.6551830 26 -14.3354954 27 -13.4044914 28 -15.8621804 29 -19.5602307 30 -15.7451809 31 -20.9417638 32 -17.9830948 33 -3.8479096 34 2.6111781 35 -2.0382796 36 -10.3197466 37 -12.1886181 38 -9.5301528 39 -8.0465470 40 -12.2949943 41 -14.5780189 42 -7.2152385 43 -8.7354402 44 -5.8941387 45 -2.1830582 46 0.7193461 47 -0.7888193 48 -5.3126818 49 -3.2187148 50 -3.9817118 51 -0.7165090 52 2.9730643 53 3.7208160 54 4.8229049 55 2.1905121 56 5.1353412 57 9.4988466 58 12.8126593 59 12.1395322 60 6.5365722 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ppyt1257283845.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/2sikd1257283845.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/3mf8y1257283845.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/4adsy1257283845.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/515vh1257283845.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/6m7pt1257283845.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/74ica1257283845.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/8h2r01257283845.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.6 121.8 122.0 126.2 134.9 > > #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/9aqs81257283845.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/107nzp1257283845.tab") > > system("convert tmp/1ppyt1257283845.ps tmp/1ppyt1257283845.png") > system("convert tmp/2sikd1257283845.ps tmp/2sikd1257283845.png") > system("convert tmp/3mf8y1257283845.ps tmp/3mf8y1257283845.png") > system("convert tmp/4adsy1257283845.ps tmp/4adsy1257283845.png") > system("convert tmp/515vh1257283845.ps tmp/515vh1257283845.png") > system("convert tmp/6m7pt1257283845.ps tmp/6m7pt1257283845.png") > system("convert tmp/74ica1257283845.ps tmp/74ica1257283845.png") > system("convert tmp/8h2r01257283845.ps tmp/8h2r01257283845.png") > > > proc.time() user system elapsed 1.568 1.181 2.074