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(87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6) > x <- c(-21.03112657,-11.68189889,5.211536493,1.476221546,-4.826590781,-7.125297956,-14.00151377,-12.72466965,-4.080658002,-5.896424559,-10.52466965,5.091579201,-27.47212823,-12.77194856,4.323698059,-2.821409422,-0.023778454,-6.429171427,-9.614604863,-8.001736656,6.671543174,-7.957044046,1.141620147,5.776221546,-22.93268649,-7.99175119,6.010810563,7.675049899,4.163126352,-6.628952311,-2.628952311,-3.316048906,10.07211806,-2.468772747,0.688289495,8.450419701,-15.90652076,-4.325489329,3.768254569,13.50060742,4.564405943,-8.553528549,2.058308663,4.161125566,1.145729881,8.516897009,0.465365856,7.238809438,-12.55352855,-8.583117349,8.040369365,6.973409219,-9.065259574,-14.1276483,-17.30550035,-15.22938895,-5.477808953,-14.38189889,-16.66693602,-5.92323801,-25.62562168) > 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.033054868 2 -0.046895122 3 0.123462936 4 0.111005619 5 0.101944818 6 0.132792863 7 0.105152963 8 0.110455816 9 0.145582294 10 0.086737173 11 0.079695084 12 0.045097489 13 0.064115584 14 -0.041604213 15 0.123715261 16 0.068726711 17 0.131978845 18 0.126932988 19 0.056905634 20 0.121486061 21 0.043042221 22 0.076168552 23 0.050285465 24 0.050882371 25 -0.038797314 26 -0.088639023 27 0.013013295 28 0.025504314 29 -0.013467895 30 0.029507239 31 -0.026421364 32 -0.029717681 33 -0.105080015 34 -0.088840583 35 -0.090045345 36 -0.060706825 37 -0.063203952 38 -0.106163110 39 -0.013074955 40 0.018492970 41 -0.020358237 42 -0.019006808 43 -0.079220328 44 -0.111439133 45 -0.053881732 46 -0.028113629 47 -0.064004754 48 -0.132155645 49 0.036921795 50 -0.189004293 51 -0.044923104 52 -0.063044560 53 -0.100120683 54 -0.066948875 55 -0.144663619 56 -0.049803521 57 -0.037731579 58 -0.009143315 59 0.007843548 60 0.013925534 61 -0.108209099 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1txxx1256742836.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/2tyi21256742836.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/3qa7f1256742836.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/4vo2i1256742836.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/5ybd71256742836.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/6w7gg1256742836.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/7x2cm1256742836.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/8w9le1256742836.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. -27.470 -10.520 -4.325 -4.254 4.163 13.500 > > #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/9uenx1256742836.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/100qdl1256742836.tab") > > system("convert tmp/1txxx1256742836.ps tmp/1txxx1256742836.png") > system("convert tmp/2tyi21256742836.ps tmp/2tyi21256742836.png") > system("convert tmp/3qa7f1256742836.ps tmp/3qa7f1256742836.png") > system("convert tmp/4vo2i1256742836.ps tmp/4vo2i1256742836.png") > system("convert tmp/5ybd71256742836.ps tmp/5ybd71256742836.png") > system("convert tmp/6w7gg1256742836.ps tmp/6w7gg1256742836.png") > system("convert tmp/7x2cm1256742836.ps tmp/7x2cm1256742836.png") > system("convert tmp/8w9le1256742836.ps tmp/8w9le1256742836.png") > > > proc.time() user system elapsed 2.548 1.933 3.005