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(-3.57,1.64,7.25,-17.07,-25.96,-8.35,9.08,20.68,66.51,54.61,34.64,30.69,31.55,24.42,30.58,8.15,9.89,23.86,36.62,40.03,80.16,51.83,27.09,35.84,37.6,30.19,19.47,5.46,16.61,16.79,32.74,33.79,61.63,30.35,3.13,-6.23,-3.22,-15.13,-25.38,-37.14,-54.12,-57.21,-31.72,-26.04,-8.72,-18.32,-53.59,-51.39,-43.35,-58.47,-64.65,-67.65,-96.39,-61.56,-46.21,-55.87,-21.47,-41.48,-56.28,-28.78) > x <- c(-0.907,-1.276,-1.605,-0.657,0.064,-0.365,0.108,-0.032,-0.719,0.291,0.024,-0.221,-0.275,0.082,0.458,0.285,-0.101,0.166,0.802,0.853,0.496,-0.067,0.119,0.344,-0.02,-0.171,-0.863,-0.474,-0.409,-0.711,-0.666,-0.611,-1.387,-1.395,-1.037,-0.933,-0.822,-0.723,-0.798,-0.734,-1.212,-1.311,-0.872,-1.124,-1.172,-0.532,0.371,0.591,0.935,1.103,1.805,1.605,2.691,3.004,3.489,3.163,2.703,1.992,0.512,-0.138) > 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 -14.0324217 2 -13.9013466 3 -12.8197105 4 -24.0914157 5 -23.0575544 6 -11.3523207 7 12.5880627 8 22.2610993 9 58.6352148 10 60.6368791 11 36.9918847 12 29.6696988 13 29.7864415 14 27.5701981 15 38.9054711 16 14.0942950 17 10.5213817 18 28.1663761 19 49.6802954 20 53.7922606 21 89.0085040 22 52.9293585 23 30.7494670 24 42.5963724 25 39.3462676 26 29.8579000 27 9.6131953 28 0.9574007 29 13.0020623 30 9.0253270 31 25.5947081 32 27.4017294 33 44.5608467 34 13.1707345 35 -9.1217448 36 -17.0502863 37 -12.5124797 38 -23.0598413 39 -34.3421431 40 -45.2212456 41 -68.7804491 42 -73.2330874 43 -41.7006809 44 -39.4892149 45 -22.8298881 46 -23.6209127 47 -46.4619990 48 -41.2339137 49 -28.4590894 50 -41.2667333 51 -37.7843885 52 -43.5371933 53 -57.3294631 54 -18.1913236 55 3.8342281 56 -10.3128438 57 17.7557052 58 -12.0405159 59 -47.2112716 60 -28.6578872 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1tbfh1259331980.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/2ayp61259331980.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/3fx8q1259331980.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/4730s1259331980.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/5nr3r1259331980.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/65qwc1259331980.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/71n331259331980.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/8y2wk1259331980.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. -1.60500 -0.75000 -0.11950 0.06193 0.46750 3.48900 > > #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/9w0xe1259331980.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/10maek1259331980.tab") > > system("convert tmp/1tbfh1259331980.ps tmp/1tbfh1259331980.png") > system("convert tmp/2ayp61259331980.ps tmp/2ayp61259331980.png") > system("convert tmp/3fx8q1259331980.ps tmp/3fx8q1259331980.png") > system("convert tmp/4730s1259331980.ps tmp/4730s1259331980.png") > system("convert tmp/5nr3r1259331980.ps tmp/5nr3r1259331980.png") > system("convert tmp/65qwc1259331980.ps tmp/65qwc1259331980.png") > system("convert tmp/71n331259331980.ps tmp/71n331259331980.png") > system("convert tmp/8y2wk1259331980.ps tmp/8y2wk1259331980.png") > > > proc.time() user system elapsed 1.586 1.138 1.976