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(6.449,5.382,5.039,4.572,2.716,2.325,2.993,1.251,2.791,4.743,5.99,5.872,6.606,5.533,5.278,3.193,1.815,1.638,1.83,2.52,3.1,4.472,5.507,5.312,6.22,5.689,5.608,3.899,2.835,2.224,1.687,1.911,2.269,4.625,5.698,5.594,6.593,6.208,5.713,4.71,3.253,1.706,1.289,0.812,0.496,3.887,5.069,4.551,5.696,5.01,4.198,4.061,2.3,0.192,0.285,0.943,0.436,3.137,4.203,4.078) > x <- c(7.649,6.882,6.239,5.172,3.116,2.925,4.493,3.151,4.591,5.943,7.09,7.072,8.306,7.333,7.078,4.693,3.315,3.538,4.63,5.62,5.9,6.772,7.207,6.912,7.92,7.489,7.308,5.499,4.235,4.124,4.287,4.711,4.869,6.525,7.198,6.994,7.893,7.408,6.713,5.51,4.353,3.406,4.189,4.212,3.596,6.287,7.069,6.451,7.596,7.01,6.398,6.261,4.3,2.092,1.985,2.443,1.736,4.737,5.903,5.578) > 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.512918314 2 0.231494120 3 0.547066798 4 1.172908240 5 1.422702059 6 1.227327846 7 0.289352794 8 -0.078145599 9 -0.013020647 10 0.554235558 11 0.626456613 12 0.526892552 13 -0.002993427 14 -0.079428551 15 -0.073252761 16 0.284509037 17 0.317882521 18 -0.087518268 19 -1.013965179 20 -1.337941775 21 -1.044723034 22 -0.565841813 23 0.023623016 24 0.130767557 25 0.006355023 26 -0.083206681 27 0.021176919 28 0.164988698 29 0.395601240 30 -0.101710475 31 -0.805658137 32 -1.015926901 33 -0.819753469 34 -0.159859774 35 0.223840985 36 0.328781617 37 0.407008930 38 0.518755040 39 0.735587095 40 0.964722291 41 0.692743424 42 0.115678612 43 -1.103284696 44 -1.603841728 45 -1.288922957 46 -0.654095703 47 -0.273034792 48 -0.158067584 49 -0.185798091 50 -0.271605884 51 -0.456783988 52 -0.453466015 53 -0.205972981 54 -0.052497907 55 0.150093503 56 0.339001300 57 0.556123980 58 0.183443411 59 0.055204309 60 0.263075414 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1vbqa1259933262.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/2elcy1259933262.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/31x7u1259933262.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/4hgzu1259933262.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/56lbw1259933263.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/6wmhn1259933263.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/71zcd1259933263.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/8hkj51259933263.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.736 4.274 5.760 5.499 7.025 8.306 > > #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/92y361259933263.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/101xu81259933263.tab") > > system("convert tmp/1vbqa1259933262.ps tmp/1vbqa1259933262.png") > system("convert tmp/2elcy1259933262.ps tmp/2elcy1259933262.png") > system("convert tmp/31x7u1259933262.ps tmp/31x7u1259933262.png") > system("convert tmp/4hgzu1259933262.ps tmp/4hgzu1259933262.png") > system("convert tmp/56lbw1259933263.ps tmp/56lbw1259933263.png") > system("convert tmp/6wmhn1259933263.ps tmp/6wmhn1259933263.png") > system("convert tmp/71zcd1259933263.ps tmp/71zcd1259933263.png") > system("convert tmp/8hkj51259933263.ps tmp/8hkj51259933263.png") > > > proc.time() user system elapsed 1.648 1.200 4.212