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(-27.765,-44.2735,-56.372,-24.67,-65.041,-67.4745,-28.269,-40.537,-48.908,31.796,-59.3465,-52.2595,-5.6045,-16.8095,-30.0925,-2.226,-78.7565,-26.061,-17.154,-27.6925,-14.6805,73.904,-44.3005,-21.71,3.969,-30.922,-0.3295,16.311,-26.0045,-19.1005,-6.7405,-7.8445,45.067,49.2225,-30.578,15.9955,38.132,-16.6675,12.4545,32.1735,-42.34,-1.289,25.6505,-0.123,26.2215,174.745,12.783,22.027,42.1505,25.7705,60.387,35.083,-19.177,10.3785,29.2325,26.409,28.46,149.656,-1.2565,-10.5575,24.6735) > x <- c(-23.9125,-25.46833,-22.30836,-2.6604,-53.03698,-30.39631,-13.78842,-11.72506,-16.89164,4.05628,-46.69887,-41.29661,-25.94771,-18.74161,-16.66795,4.17272,-46.44067,-24.71058,-1.32472,-3.47795,-6.62619,4.08012,-38.81779,-30.3736,-5.99318,-14.48936,-1.46121,18.00198,-44.69371,-13.62779,15.38701,13.18509,11.69486,32.09375,-13.63824,-2.95771,14.76756,10.57155,30.94711,36.49473,-20.827,2.69198,27.69919,33.71066,30.38377,30.0553,-2.62346,19.47366,14.04519,28.61079,28.17846,48.44054,-11.52026,7.93263,43.95355,38.95402,29.191,42.95308,-13.35067,-1.23265,26.20273) > 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 4.3291110 2 -10.0918236 3 -26.4302753 4 -21.0913104 5 6.1314524 6 -26.6806100 7 -9.7590716 8 -24.7956253 9 -26.2342654 10 26.3624527 11 3.3216692 12 3.1600810 13 29.2203939 14 8.3464681 15 -7.7189058 16 -7.8157829 17 -16.4347757 18 7.1039505 19 -15.3674852 20 -23.0168466 21 -5.7806340 22 68.4384649 23 7.7930758 24 19.0534185 25 12.0195125 26 -11.4715716 27 1.6401530 28 -7.8344634 29 33.9732065 30 -0.8061000 31 -27.3772762 32 -25.5268069 33 29.3842384 34 6.1691283 35 -12.2695786 36 19.9731112 37 18.3263830 38 -30.8430384 39 -29.0603451 40 -16.7849728 41 -14.3859190 42 -4.8919710 43 -11.5063848 44 -45.3458924 45 -14.5374726 46 134.4267585 47 16.3121247 48 -4.0931188 49 23.3141371 50 -12.6095420 51 22.5870453 52 -29.9039974 53 -3.7104197 54 -0.2562158 55 -29.7339907 56 -25.8492734 57 -10.6985501 58 92.0319096 59 16.6660688 60 -8.8945219 61 -10.4754803 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1at991257193613.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/2k2xg1257193613.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/3h3ho1257193613.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/4p3f11257193613.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/5jr2e1257193613.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/6aekp1257193613.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/74oly1257193613.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/8ttc61257193613.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. -53.040000 -16.890000 -1.461000 0.003309 19.470000 48.440000 > > #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/925wo1257193613.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/10zt6o1257193613.tab") > > system("convert tmp/1at991257193613.ps tmp/1at991257193613.png") > system("convert tmp/2k2xg1257193613.ps tmp/2k2xg1257193613.png") > system("convert tmp/3h3ho1257193613.ps tmp/3h3ho1257193613.png") > system("convert tmp/4p3f11257193613.ps tmp/4p3f11257193613.png") > system("convert tmp/5jr2e1257193613.ps tmp/5jr2e1257193613.png") > system("convert tmp/6aekp1257193613.ps tmp/6aekp1257193613.png") > system("convert tmp/74oly1257193613.ps tmp/74oly1257193613.png") > system("convert tmp/8ttc61257193613.ps tmp/8ttc61257193613.png") > > > proc.time() user system elapsed 1.568 1.153 1.972