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(82.3975,86.3819,86.1038,84.5059,82.7593,83.6718,74.8676,77.8998,81.6094,80.2569,78.934,76.8461,76.4379,83.14,84.6699,83.9001,84.4128,84.5982,76.5504,77.3826,80.4645,81.7259,81.1172,79.0921,82.5387,87.1251,89.2859,88.3042,89.4752,88.2355,81.8561,83.0776,87.1477,90.7124,89.762,88.3862,91.2844,94.0694,97.8276,96.8148,97.3319,98.5312,91.1703,91.3694,95.5428,97.6763,97.7141,96.3445,100.025,102.3597,105.204,102.4316,103.4731,104.1694,93.5787,99.1232,103.4544,105.7473,104.2672,103.1026) > x <- c(88.7233,91.9441,87.6443,92.3349,86.7446,90.4944,90.0456,90.2818,95.7701,94.2684,92.6972,88.3027,92.262,95.3634,97.9526,95.5567,94.2145,94.6263,90.8046,91.1568,90.99,93.2625,92.6989,87.1384,94.8365,99.3737,98.8442,98.1394,96.5231,99.9541,92.8272,96.4591,99.2824,97.5254,98.1819,97.8293,99.0573,105.7607,105.4583,107.8701,107.5543,104.2246,101.322,100.3369,106.9387,108.0687,106.1259,105.9,109.7624,111.8431,110.758,108.6872,106.4739,105.1487,98.9033,101.3615,107.2762,104.6946,106.2082,101.3239) > 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.2577722 2 4.4844209 3 9.2229563 4 2.1524692 5 6.9281485 6 3.4657057 7 -4.8148733 8 -2.0582510 9 -4.7519256 10 -4.3523717 11 -3.8421312 12 -0.8029080 13 -5.8304774 14 -2.7468231 15 -4.2377782 16 -2.2122489 17 -0.1335858 18 -0.4286385 19 -4.0176089 20 -3.5963255 21 -0.3198176 22 -1.7097744 23 -1.6609146 24 2.8014967 25 -2.7333817 26 -3.4405949 27 -0.6620201 28 -0.8214203 29 2.2353390 30 -3.0073555 31 -1.0717040 32 -4.0875913 33 -3.3114740 34 2.3031419 35 0.5867944 36 -0.3776224 37 1.0878533 38 -3.9480951 39 0.1629191 40 -3.6637609 41 -2.7782127 42 2.3058938 43 -1.6685032 44 -0.3200735 45 -3.8490838 46 -3.0339702 47 -0.7294789 48 -1.8355183 49 -2.6613331 50 -2.7542142 51 1.3560868 52 0.9997174 53 4.6235047 54 6.8659337 55 3.5618272 56 6.2383117 57 3.6687504 58 8.9736384 59 5.7276006 60 10.2615801 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/14xgn1257169080.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/2cne61257169080.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/3jn251257169080.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/4d8as1257169080.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/5n3pq1257169080.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/62tuh1257169080.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/7b4zk1257169080.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/8pv871257169080.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. 86.74 92.70 98.05 98.44 105.20 111.80 > > #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/9ldgk1257169080.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/10wmyn1257169080.tab") > > system("convert tmp/14xgn1257169080.ps tmp/14xgn1257169080.png") > system("convert tmp/2cne61257169080.ps tmp/2cne61257169080.png") > system("convert tmp/3jn251257169080.ps tmp/3jn251257169080.png") > system("convert tmp/4d8as1257169080.ps tmp/4d8as1257169080.png") > system("convert tmp/5n3pq1257169080.ps tmp/5n3pq1257169080.png") > system("convert tmp/62tuh1257169080.ps tmp/62tuh1257169080.png") > system("convert tmp/7b4zk1257169080.ps tmp/7b4zk1257169080.png") > system("convert tmp/8pv871257169080.ps tmp/8pv871257169080.png") > > > proc.time() user system elapsed 2.571 1.912 2.930