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(-93.77360523,-93.73306095,-103.1358493,-114.0870047,-115.5549183,-117.6437844,-126.5568902,-127.2161645,-115.1845555,-109.2791818,-109.4382293,-116.8531948,-108.2587736,-115.8829226,-96.19798101,-95.46720995,-86.5947845,-80.67913874,-83.53659877,-89.11287953,-94.71811708,-106.1183654,-145.5773415,-155.5792227,-176.9022139,-215.8126868,-255.5621618,-264.1545419,-294.3010925,-326.5270535,-336.4087986,-312.4377123,-335.55025,-315.6649002,-292.2127707,-282.1103453,-275.2843366,-248.7445657,-192.5572009,-187.7306026,-166.0571578,-125.4087714,-119.8134431,-148.9118987,-127.2784992) > x <- c(-1.527069369,-1.543374062,-1.749411243,-1.984362504,-2.096863827,-2.130831937,-2.327358048,-2.269097638,-1.977733622,-1.639143732,-1.587676945,-1.708495354,-1.531372252,-1.826647701,-1.405551196,-1.428649511,-1.081742534,-0.92130499,-0.997393557,-0.998808959,-1.061475023,-1.223600771,-2.08296827,-2.28617994,-2.785701594,-3.810231187,-4.554652717,-4.762918418,-5.315378939,-5.935502878,-6.172790721,-5.606202641,-5.87931154,-5.050443555,-4.325106136,-4.008199159,-3.888631411,-3.712640323,-2.205439375,-2.033535044,-1.427600633,-0.420569718,-0.260621103,-0.766015199,-0.208722064) > par2 = '10' > 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 29.552145 2 30.355805 3 30.596258 4 30.641622 5 34.439153 6 33.940111 7 34.225096 8 30.839036 9 29.233817 10 19.292031 11 16.724162 12 14.963910 13 15.268366 14 21.464114 15 21.440305 16 23.252156 17 15.888153 18 14.294775 19 14.998520 20 9.488484 21 6.816232 22 3.004021 23 3.766371 24 3.275488 25 5.331812 26 14.372813 27 9.464801 28 10.619965 29 6.330449 30 3.128400 31 4.352535 32 1.805369 33 -8.524742 34 -27.433237 35 -37.929369 36 -42.659270 37 -41.429439 38 -23.126651 39 -37.481424 40 -40.700534 41 -47.386883 42 -53.870973 43 -55.761785 44 -61.206076 45 -65.655893 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1mzql1257088434.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/25mbw1257088434.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/34r3n1257088434.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/4e4zl1257088434.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/572qb1257088434.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/61sfh1257088434.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/76lmj1257088434.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/8fo5y1257088434.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. -6.1730 -3.8100 -1.9840 -2.5000 -1.4280 -0.2087 > > #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/9rfv01257088434.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/1037of1257088434.tab") > > system("convert tmp/1mzql1257088434.ps tmp/1mzql1257088434.png") > system("convert tmp/25mbw1257088434.ps tmp/25mbw1257088434.png") > system("convert tmp/34r3n1257088434.ps tmp/34r3n1257088434.png") > system("convert tmp/4e4zl1257088434.ps tmp/4e4zl1257088434.png") > system("convert tmp/572qb1257088434.ps tmp/572qb1257088434.png") > system("convert tmp/61sfh1257088434.ps tmp/61sfh1257088434.png") > system("convert tmp/76lmj1257088434.ps tmp/76lmj1257088434.png") > system("convert tmp/8fo5y1257088434.ps tmp/8fo5y1257088434.png") > > > proc.time() user system elapsed 2.495 1.864 2.750