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(-97.0413027,-338.0413544,138.4587102,517.4586327,-277.5414708,-120.5415742,-305.0415871,-253.0417423,439.458193,110.4581672,858.4581155,519.9579991,-967.5420397,-129.5420138,57.95794738,-375.5420397,-542.041975,874.4581413,834.4581155,299.4582189,1419.958258,260.9582836,803.9583353,1090.958387,229.4584516,360.9584646,601.9584387,909.4584516,-243.5415484,118.4583741,229.4583741,-326.5416518,589.9583611,-301.5416259,-385.5416259,596.4583741,-187.041613,110.4583999,-639.0415871,1058.4584,-259.5416259,-637.5416001,4.45845164,299.9583611,-117.0416389,-15.54167766,-420.0416389,326.4583999,-670.5416777,-811.0416906,-199.0416906,-562.5416777,-445.5416518,242.4583482,-1460.541704,-941.0416389,-584.041613,-289.5416001,-643.5416259,-358.5416518) > x <- c(335.2807094,-6315.156455,-8630.36,7249.484254,3022.609926,6452.735598,3829.376307,-360.9351859,4232.268359,-4860.450223,-4137.887387,-3268.121007,-3195.19888,-4482.480298,-12291.55817,8975.80112,6572.597575,11656.83119,4297.112613,3942.986941,926.0648141,-4589.216604,-5380.77944,-4466.342276,-1629.54582,-5233.186529,-13266.90511,8499.45418,3926.45418,7970.298433,3178.298433,2400.579851,3087.939142,-2262.701567,-3992.701567,-2256.701567,2104.657724,-2847.982984,-9914.623693,8904.017016,7430.298433,7357.017016,9309.45418,3135.939142,4144.939142,-2513.138731,-4901.060858,-2141.982984,-200.1387307,-7155.498022,-11218.49802,2728.861269,1390.579851,5086.579851,3458.142687,-2174.060858,87.65772447,-3633.982984,-5709.701567,-2663.420149) > 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 -100.46007 2 -273.64746 3 226.46010 4 443.53765 5 -308.36219 6 -186.33833 7 -344.08867 8 -249.36139 9 396.30293 10 160.01883 11 900.65100 12 553.28212 13 -934.96148 14 -83.83541 15 183.29156 16 -467.06579 17 -609.06093 18 755.59667 19 790.64165 20 259.25268 21 1410.51543 22 307.75325 23 858.82465 24 1136.50044 25 246.07448 26 414.31982 27 737.23739 28 822.79188 29 -283.57851 30 37.18745 31 197.05015 32 -351.01970 33 558.47150 34 -278.46949 35 -344.82916 36 619.46933 37 -208.50222 38 139.49849 39 -537.94492 40 967.66661 41 -335.30632 42 -712.55906 43 -90.46747 44 267.98206 45 -159.30643 46 10.08410 47 -370.06688 48 348.29961 49 -668.50092 50 -738.07906 51 -84.64978 52 -590.36712 53 -459.72101 54 190.59190 55 -1495.80343 56 -918.87334 57 -584.93543 58 -252.48688 59 -585.32138 60 -331.38350 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15s1a1257271441.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/2l56s1257271441.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/3z56p1257271441.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/4byeo1257271441.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/5x6ar1257271441.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/6dj4x1257271441.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/794io1257271441.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/8uyx11257271441.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. -1.327e+04 -4.220e+03 -5.624e+01 -9.383e-08 3.993e+03 1.166e+04 > > #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/9rxxy1257271441.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/1007au1257271441.tab") > > system("convert tmp/15s1a1257271441.ps tmp/15s1a1257271441.png") > system("convert tmp/2l56s1257271441.ps tmp/2l56s1257271441.png") > system("convert tmp/3z56p1257271441.ps tmp/3z56p1257271441.png") > system("convert tmp/4byeo1257271441.ps tmp/4byeo1257271441.png") > system("convert tmp/5x6ar1257271441.ps tmp/5x6ar1257271441.png") > system("convert tmp/6dj4x1257271441.ps tmp/6dj4x1257271441.png") > system("convert tmp/794io1257271441.ps tmp/794io1257271441.png") > system("convert tmp/8uyx11257271441.ps tmp/8uyx11257271441.png") > > > proc.time() user system elapsed 1.601 1.176 2.159