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(323.691,350.803,388.226,357.579,287.11,405.944,198.467,155.467,397.006,373.637,294.89,327.969,327.724,292.554,378.724,295.778,304.529,412.085,193.745,173.272,370.197,287.305,286.247,328.612,308.948,305.695,341.193,276.944,242.4,336.363,208.546,168.409,288.587,289.475,322.944,260.475,320.442,294.222,338.641,275.28,302.027,303.031,191.301,210.853,330.894,359.84,287.778,249.446,318.666,280.695,259.479,341.558,249.197,358.313,215.363,187.438,342.541,383.143,306.641,363.313) > x <- c(-39.26,-25.87,-45.916,-30.457,14.763,-54.264,-30.363,-22.122,-77.308,-38.545,10.958,-35.195,-51.587,-5.585,-65.524,-38.868,19.088,-24.895,-20.015,-27.514,-1.002,37.589,-12.128,-59.413,-1.956,-3.325,-39.348,-40.541,-14.302,-30.87,-11.015,-29.057,-4.216,14.958,-50.543,-1.019,-33.26,-22.107,-50.631,-15.65,-37.629,3.153,-48.428,-67.124,-6.805,-14.763,-12.172,9.786,-12.608,-37.65,5.937,-62.979,-3.975,40.65,-38.843,-50.558,-15.111,-39.568,-9.847,-25.285) > 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 19.4832467 2 50.9991138 3 81.8291399 4 56.2664851 5 0.6699923 6 96.8015475 7 -102.8145991 8 -143.1041981 9 80.2845546 10 69.6644046 11 7.1985573 12 25.0981936 13 19.4619920 14 -0.5783071 15 65.8782208 16 -8.3008276 17 19.5114512 18 112.6017837 19 -104.1332221 20 -127.0725851 21 78.5720061 22 8.3722866 23 -9.0372490 24 17.7760813 25 17.0092429 26 13.3059894 27 36.9563041 28 -27.6850643 29 -53.5992608 30 34.9146526 31 -86.3721919 32 -132.4430658 33 -4.0950536 34 3.0991263 35 15.0253555 36 -31.1555851 37 18.2076001 38 -4.3442647 39 30.6934130 40 -21.1626075 41 -1.6443301 42 12.7725533 43 -115.9220374 44 -102.5190068 45 37.3604444 46 63.6891199 47 -7.5207203 48 -38.6309044 49 23.2238827 50 -22.9832368 51 -29.8638107 52 29.5492516 53 -43.4057906 54 80.3870257 55 -88.7076053 56 -120.4855779 57 46.2756654 58 78.8339479 59 12.1069542 60 63.7015158 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1z8sr1257272807.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/2vpx81257272807.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/38cy11257272807.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/4l2gd1257272807.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/50fsu1257272807.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/6ureb1257272807.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/7b6jx1257272807.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/819cm1257272807.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. -77.310 -39.280 -25.090 -23.000 -5.243 40.650 > > #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/9uchf1257272807.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/10p75o1257272807.tab") > > system("convert tmp/1z8sr1257272807.ps tmp/1z8sr1257272807.png") > system("convert tmp/2vpx81257272807.ps tmp/2vpx81257272807.png") > system("convert tmp/38cy11257272807.ps tmp/38cy11257272807.png") > system("convert tmp/4l2gd1257272807.ps tmp/4l2gd1257272807.png") > system("convert tmp/50fsu1257272807.ps tmp/50fsu1257272807.png") > system("convert tmp/6ureb1257272807.ps tmp/6ureb1257272807.png") > system("convert tmp/7b6jx1257272807.ps tmp/7b6jx1257272807.png") > system("convert tmp/819cm1257272807.ps tmp/819cm1257272807.png") > > > proc.time() user system elapsed 1.588 1.162 2.669