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,97,154,81,110,116,73,73,174,103,130,91,136,106,136,122,131,135,75,68,143,115,93,128,152,125,107,116,220,137,34,51,153,145,116,145,98,118,139,140,113,149,79,47,166,180,122,134,114,125,181,142,143,187,137,62,239,157,139,187) > x <- c(182,213,227,209,219,221,114,97,205,215,224,189,182,201,198,173,238,258,122,101,259,243,188,173,224,215,196,159,187,208,131,93,210,228,176,195,188,188,190,188,176,225,93,79,235,247,195,197,211,166,209,180,185,303,129,85,249,231,212,240) > par2 = '1' > 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 -30.2089805 2 -40.4207066 3 8.3546429 4 -54.0708064 5 -30.9455568 6 -26.1205069 7 -6.2606782 8 3.7263974 9 41.2790937 10 -35.5956566 11 -13.8829320 12 -32.3213058 13 16.7910195 14 -24.3710062 15 7.3914189 16 8.0782948 17 -21.1075824 18 -28.8570831 19 -8.9604785 20 -3.6235027 21 -21.4445582 22 -40.0449576 23 -29.7338307 24 14.0782948 25 8.1170680 26 -13.5956566 27 -20.4336310 28 10.3029453 29 97.8536443 30 2.5166686 31 -55.2477538 32 -15.9237025 33 17.3417185 34 -1.2328321 35 0.3158697 36 18.1538440 37 -24.7338307 38 -4.7338307 39 15.0912192 40 17.2661693 41 -2.6841303 42 4.5295930 43 12.0762975 44 -11.6990520 45 15.6548427 46 22.6051423 47 -4.8461560 48 5.9788940 49 -22.2457565 50 15.1906200 51 45.9291936 52 23.9659696 53 22.0285944 54 -3.2934597 55 48.9271963 56 -0.2239022 57 80.4301922 58 9.0047428 59 2.1667685 60 33.7174675 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1yxrz1257272006.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/2jn4f1257272006.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/3zfof1257272006.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/4r1m21257272006.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/5rc5i1257272006.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/64giy1257272006.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/75li11257272006.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/85zrw1257272006.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. 79.0 176.0 196.5 191.2 221.8 303.0 > > #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/9sbep1257272006.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/1003bi1257272006.tab") > > system("convert tmp/1yxrz1257272006.ps tmp/1yxrz1257272006.png") > system("convert tmp/2jn4f1257272006.ps tmp/2jn4f1257272006.png") > system("convert tmp/3zfof1257272006.ps tmp/3zfof1257272006.png") > system("convert tmp/4r1m21257272006.ps tmp/4r1m21257272006.png") > system("convert tmp/5rc5i1257272006.ps tmp/5rc5i1257272006.png") > system("convert tmp/64giy1257272006.ps tmp/64giy1257272006.png") > system("convert tmp/75li11257272006.ps tmp/75li11257272006.png") > system("convert tmp/85zrw1257272006.ps tmp/85zrw1257272006.png") > > > proc.time() user system elapsed 2.541 1.905 2.987