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(476,475,470,461,455,456,517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514) > x <- c(5.894402834,5.897153868,5.894402834,5.880532986,5.877735782,5.877735782,5.940171253,5.934894196,5.929589143,5.940171253,5.937536205,5.950642553,5.97126184,5.976350909,5.97126184,5.981414211,5.97126184,5.981414211,6.03787092,6.042632834,6.040254711,6.035481433,6.01615716,6.035481433,6.054439346,6.059123196,6.063785209,6.049733455,6.047372179,6.056784013,6.089044875,6.107022888,6.11368218,6.135564891,6.120297419,6.133398043,6.133398043,6.137727054,6.135564891,6.12249281,6.120297419,6.12249281,6.156978986,6.156978986,6.154858094,6.142037406,6.12905021,6.142037406,6.148468296,6.146329258,6.137727054,6.131226489,6.135564891,6.133398043,6.165417854,6.165417854,6.154858094,6.115892125,6.09356977,6.091309882,6.095824562,6.08221891,6.056784013,6.049733455,6.03068526,6.00635316,6.06610809,6.073044534,6.035481433,6.021023349,6.001414878,6.013715156) > 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 0.9498737 2 -1.4136643 3 -5.0501263 4 -7.1755966 5 -11.7891747 6 -10.7891747 7 19.2649565 8 29.8805067 9 30.5099331 10 21.2649565 11 12.5710065 12 9.0749023 13 5.8550426 14 1.3326678 15 -3.1449574 16 -9.1769358 17 -12.1449574 18 -11.1769358 19 22.8405426 20 31.4803207 21 30.6590270 22 20.0248815 23 11.6028731 24 10.0248815 25 7.6284746 26 4.3069447 27 -4.0037617 28 -8.0390711 29 -13.8687149 30 -12.5336494 31 22.4763951 32 30.5656713 33 29.2650223 34 16.4189520 35 6.9862079 36 1.4929408 37 -2.5070592 38 -6.6527146 39 -10.5810480 40 -15.1019280 41 -20.0137921 42 -19.1019280 43 15.8051493 44 23.8051493 45 23.8563601 46 14.2108782 47 3.6479253 48 -0.7891218 49 -7.9765644 50 -9.9163595 51 -15.6527146 52 -18.4307379 53 -21.5810480 54 -20.5070592 55 10.6224611 56 16.6224611 57 15.8563601 58 3.1696727 59 -7.7663494 60 -15.6462458 61 -13.8839272 62 -19.1403452 63 -23.5336494 64 -26.0390711 65 -31.5979163 66 -31.5378171 67 -5.1550875 68 1.4068943 69 -2.9751185 70 -10.8090323 71 -18.0901791 72 -20.1867583 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1wyyp1256672847.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/2wte91256672847.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/3okwg1256672847.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/4kj0t1256672847.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/5qxiy1256672847.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/67p7g1256672847.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/7g7ce1256672847.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/8njvu1256672847.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. 5.878 5.996 6.058 6.053 6.132 6.165 > > #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/92e611256672847.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/1063y51256672847.tab") > > system("convert tmp/1wyyp1256672847.ps tmp/1wyyp1256672847.png") > system("convert tmp/2wte91256672847.ps tmp/2wte91256672847.png") > system("convert tmp/3okwg1256672847.ps tmp/3okwg1256672847.png") > system("convert tmp/4kj0t1256672847.ps tmp/4kj0t1256672847.png") > system("convert tmp/5qxiy1256672847.ps tmp/5qxiy1256672847.png") > system("convert tmp/67p7g1256672847.ps tmp/67p7g1256672847.png") > system("convert tmp/7g7ce1256672847.ps tmp/7g7ce1256672847.png") > system("convert tmp/8njvu1256672847.ps tmp/8njvu1256672847.png") > > > proc.time() user system elapsed 1.622 1.178 2.655