R version 2.8.1 (2008-12-22) 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(324,384.16,542.89,561.69,412.09,519.84,590.49,462.25,552.25,492.84,436.81,492.84,380.25,445.21,484,368.64,316.84,368.64,396.01,384.16,327.61,416.16,327.61,345.96,309.76,376.36,372.49,345.96,285.61,268.96,361,349.69,292.41,462.25,316.84,327.61,361,357.21,282.24,327.61,246.49,228.01,334.89,272.25,285.61,338.56,268.96,246.49,285.61,275.56,278.89,275.56,207.36,210.25,306.25,204.49,237.16,295.84,213.16,201.64,222.01,198.81,243.36,213.16,141.61,182.25,201.64,187.69,207.36,234.09,204.49,210.25) > x <- c(268.96,316.84,497.29,519.84,334.89,501.76,571.21,453.69,529,457.96,449.44,436.81,320.41,428.49,492.84,392.04,313.29,384.16,432.64,392.04,345.96,441,345.96,357.21,299.29,400,396.01,380.25,262.44,309.76,392.04,376.36,295.84,445.21,316.84,306.25,324,364.81,313.29,368.64,228.01,265.69,345.96,295.84,316.84,364.81,275.56,256,278.89,302.76,320.41,316.84,193.21,252.81,320.41,237.16,268.96,320.41,234.09,213.16,222.01,225,278.89,265.69,136.89,228.01,240.25,225,237.16,256,216.09,219.04) > 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 67.785652 2 75.676155 3 37.413031 4 31.595714 5 83.901384 6 9.483235 7 4.316263 8 4.370150 9 12.155952 10 30.298689 11 -16.430222 12 53.387659 13 67.868868 14 14.840412 15 -16.619006 16 -21.937960 17 12.231608 18 -13.335544 19 -38.890048 20 -6.417960 21 -12.663481 22 -27.866468 23 -12.663481 24 -6.594848 25 20.435087 26 -22.907709 27 -22.421917 28 -31.747087 29 36.513386 30 -31.794772 31 -29.577960 32 -23.770463 33 6.851373 34 13.627572 35 8.356155 36 30.687015 37 44.699747 38 -3.641593 39 -22.368392 40 -37.422717 41 34.979827 42 -24.634564 43 -5.383481 44 -13.308627 45 -22.873845 46 -22.291593 47 5.540583 48 4.423786 49 18.555299 50 -17.553033 51 -33.491132 52 -32.923845 53 33.840188 54 -28.333764 55 -6.131132 56 -17.009018 57 -19.054348 58 -16.541132 59 -4.987570 60 6.341231 61 17.049889 62 -9.414225 63 -23.694701 64 -39.484564 65 29.573440 66 -29.260173 67 -23.232300 68 -20.534225 69 -14.139018 70 -7.976214 71 5.992617 72 8.532170 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1by9x1256746428.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/rcomp/tmp/2h0sy1256746428.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/rcomp/tmp/3wz451256746428.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/rcomp/tmp/4850n1256746428.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/rcomp/tmp/5ww1t1256746428.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/rcomp/tmp/6ik531256746428.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/rcomp/tmp/78jam1256746428.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/rcomp/tmp/89qbv1256746428.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. 136.9 264.9 316.8 331.8 392.0 571.2 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9zsuz1256746428.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/rcomp/tmp/10agev1256746428.tab") > > system("convert tmp/1by9x1256746428.ps tmp/1by9x1256746428.png") > system("convert tmp/2h0sy1256746428.ps tmp/2h0sy1256746428.png") > system("convert tmp/3wz451256746428.ps tmp/3wz451256746428.png") > system("convert tmp/4850n1256746428.ps tmp/4850n1256746428.png") > system("convert tmp/5ww1t1256746428.ps tmp/5ww1t1256746428.png") > system("convert tmp/6ik531256746428.ps tmp/6ik531256746428.png") > system("convert tmp/78jam1256746428.ps tmp/78jam1256746428.png") > system("convert tmp/89qbv1256746428.ps tmp/89qbv1256746428.png") > > > proc.time() user system elapsed 1.590 1.490 3.296