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(5594,5585,5710,5511,5403,5826,5884,5965,5960,6064,6046,5954,5952,5960,5983,5996,6021,6094,6202,6276,6306,6342,6345,6328,6191,6261,6253,6198,6247,6293,6381,6448,6470,6516,6532,6526,6533,6498,6507,6464,6453,6468,6497,6808,6793,6907,6792,6757,6734,6654,6589,6469,6521,6448,6410,6528,6445,6458,6215,6167) > x <- c(8.629449874,8.627839712,8.649974303,8.614501374,8.594709634,8.670085938,8.679992082,8.693664335,8.69282576,8.710124927,8.707152175,8.691818542,8.691482577,8.69282576,8.696677393,8.698847859,8.703008637,8.71505996,8.7326271,8.744488114,8.74925684,8.754949455,8.75542238,8.752739509,8.730851904,8.742095196,8.740816628,8.731981938,8.739856627,8.747193184,8.761080104,8.771525284,8.774931387,8.78201597,8.784468454,8.783549477,8.784621535,8.779249716,8.780633799,8.7740036,8.772300418,8.774622221,8.779095811,8.82585367,8.823647949,8.840290669,8.823500728,8.818334284,8.8149246,8.802973457,8.793156871,8.774776816,8.782783017,8.771525284,8.76561455,8.783855897,8.771059915,8.773074951,8.734721004,8.726967775) > 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 17.8243905 2 18.7442650 3 7.3776351 4 26.9190024 5 40.8518127 6 -0.5259820 7 -3.5556832 8 -6.7876017 9 -6.6213148 10 -9.1978992 11 -8.8833899 12 -6.4160534 13 -6.3462426 14 -6.6213148 15 -7.3504279 16 -7.7222193 17 -8.3559106 18 -9.6016152 19 -9.8291257 20 -8.9023760 21 -8.2815090 22 -7.3525308 23 -7.2661238 24 -7.7375113 25 -9.8925109 26 -9.1601039 27 -9.2831113 28 -9.8544163 29 -9.3687440 30 -8.5677519 31 -6.1221893 32 -3.4727796 33 -2.4570746 34 -0.1037229 35 0.7870312 36 0.4486581 37 0.8439309 38 -1.0614050 39 -0.5884537 40 -2.7411711 41 -3.2482196 42 -2.5523669 43 -1.1132282 44 21.8212884 45 20.4102785 46 31.8779282 47 20.3172766 48 17.1466679 49 15.1530247 50 8.7815410 51 4.2594939 52 -2.5047947 53 0.1706594 54 -3.4727796 55 -5.0579718 56 0.5608680 57 -3.6057376 58 -3.0199570 59 -9.7292345 60 -9.9631967 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1pyq41256764871.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/24xgd1256764871.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/3dbeq1256764871.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/4es0l1256764871.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/54db41256764871.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/6apkm1256764871.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/72ydq1256764871.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/8llr41256764871.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. 8.595 8.706 8.754 8.744 8.780 8.840 > > #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/9e1n31256764871.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/10lves1256764871.tab") > > system("convert tmp/1pyq41256764871.ps tmp/1pyq41256764871.png") > system("convert tmp/24xgd1256764871.ps tmp/24xgd1256764871.png") > system("convert tmp/3dbeq1256764871.ps tmp/3dbeq1256764871.png") > system("convert tmp/4es0l1256764871.ps tmp/4es0l1256764871.png") > system("convert tmp/54db41256764871.ps tmp/54db41256764871.png") > system("convert tmp/6apkm1256764871.ps tmp/6apkm1256764871.png") > system("convert tmp/72ydq1256764871.ps tmp/72ydq1256764871.png") > system("convert tmp/8llr41256764871.ps tmp/8llr41256764871.png") > > > proc.time() user system elapsed 2.631 1.936 2.998