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(-9.314,-5.0234,9.814,8.1308,-10.2608,-15.3104,4.6961,-2.2175,6.0038,-1.2903,2.5262,1.1646,-7.4196,5.355,14.0077,4.5124,-3.8231,-16.2402,8.6444,0.0841,-3.0662,10.6491,-2.219,-1.2421,-5.2066,5.9774,9.549,8.2253,-6.2735,-21.3735,8.4939,3.0555,-4.8665,10.9275,-3.7873,-5.1465,-1.1365,5.8179,3.1025,10.4451,-6.8916,-21.2798,11.7841,-4.1934,-0.0117,1.7321,-6.8123,-7.9135,-0.168,2.0539,8.7166,12.7296,-4.5136,-13.8994,10.342,-3.6225,1.558,11.2231,-4.3136,-5.8018) > x <- c(-0.115348744,-0.007430684,0.133083506,0.10990307,-0.044227883,-0.027962073,0.124923169,0.069938271,0.10207697,0.074946808,0.033187327,0.032240529,-0.099390858,0.015707515,0.144498623,0.054184893,-0.105055816,-0.182509537,0.023413818,-0.034617275,-0.030773287,0.088969168,-0.018347742,0.015141613,-0.083681811,0.012257933,0.063956725,0.050285253,-0.148793116,-0.211572756,0.038835971,-0.054887315,-0.064381527,0.040560126,-0.096653186,-0.03730336,-0.058279231,0.01374282,0.012929942,0.031409519,-0.167303701,-0.234454594,0.071595677,-0.058758499,-0.029159212,-0.003939614,-0.04168033,-0.040265025,-0.036687857,0.120682129,0.186906774,0.188095521,-0.048823116,-0.02473896,0.058343008,0.047528578,0.098720517,0.159550648,0.025284856,0.032824856) > 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.71122171 2 -4.22721357 3 0.44565112 4 0.43928077 5 -6.80277259 6 -13.02901105 7 -4.08194527 8 -7.01803996 9 -1.12159371 10 -6.45314822 11 0.38415502 12 -0.90895538 13 0.02881448 14 4.47741213 15 3.81360277 16 0.85143012 17 4.03510701 18 -2.77913478 19 7.20935249 20 2.84691389 21 -0.58145306 22 4.47190033 23 -0.63309388 24 -2.07875158 25 1.10545122 26 5.34934848 27 5.18115396 28 4.84642283 29 4.74858200 30 -5.81005554 31 5.94324261 32 7.28461091 33 0.04940455 34 8.25212044 35 3.46307638 36 -2.18937971 37 3.33797580 38 5.08243451 39 2.42583659 40 8.43165834 41 5.46950331 42 -4.06112591 43 6.86366637 44 0.31574516 45 2.35628776 46 2.27574892 47 -3.53855784 48 -4.74213837 49 2.74459594 50 -6.41735632 51 -4.54522404 52 -0.61821579 53 -0.72316198 54 -11.85116505 55 6.38023981 56 -6.80196442 57 -5.32459413 58 -0.05983274 59 -5.88399492 60 -7.91762450 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/14kgk1257173299.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/2sybt1257173299.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/3649q1257173299.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/4x9381257173299.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/5jvpc1257173299.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/6gwkn1257173299.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/7upcv1257173299.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/8grvz1257173299.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. -0.234500 -0.045380 0.013340 0.002812 0.059750 0.188100 > > #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/9xe491257173299.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/1097y61257173299.tab") > system("convert tmp/14kgk1257173299.ps tmp/14kgk1257173299.png") > system("convert tmp/2sybt1257173299.ps tmp/2sybt1257173299.png") > system("convert tmp/3649q1257173299.ps tmp/3649q1257173299.png") > system("convert tmp/4x9381257173299.ps tmp/4x9381257173299.png") > system("convert tmp/5jvpc1257173299.ps tmp/5jvpc1257173299.png") > system("convert tmp/6gwkn1257173299.ps tmp/6gwkn1257173299.png") > system("convert tmp/7upcv1257173299.ps tmp/7upcv1257173299.png") > system("convert tmp/8grvz1257173299.ps tmp/8grvz1257173299.png") > > > proc.time() user system elapsed 2.662 2.006 3.143