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(22.70,22.37,20.74,17.56,16.64,18.19,24.35,26.72,26.04,23.03,20.42,20.42,21.39,21.71,21.39,20.10,19.46,19.78,23.36,24.02,23.69,21.71,20.42,20.74,21.06,21.06,20.42,19.78,19.78,19.78,22.37,23.03,22.37,20.74,19.78,19.78,20.10,20.10,20.10,20.42,19.14,17.56,17.88,16.94,15.72,16.33,16.33,16.64,16.33,15.41,13.92,13.04,12.17,13.33,17.25,18.82,17.56,16.33,15.11,16.02) > x <- c(17.25,16.64,15.11,13.04,12.17,12.45,15.41,16.64,16.94,15.72,15.11,15.41,16.02,16.02,16.02,15.11,15.11,13.92,15.11,15.11,15.41,15.72,15.72,16.33,16.94,17.25,17.25,17.25,16.33,14.51,13.33,12.45,12.74,13.33,13.62,13.92,14.21,13.92,13.33,13.62,13.04,11.88,12.74,12.45,11.88,11.60,11.31,12.17,13.04,13.04,11.88,11.03,10.20,11.03,14.21,14.51,13.33,11.03,10.20,11.31) > 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.65775338 2 -0.24919849 3 -0.02675753 4 -0.70051389 5 -0.56716511 6 0.64382609 7 3.22001875 8 4.10080151 9 3.05757780 10 1.52468758 11 -0.34675753 12 -0.70998125 13 -0.47853614 14 -0.15853614 15 -0.47853614 16 -0.66675753 17 -1.30675753 18 0.45402988 19 2.59324247 20 3.25324247 21 2.56001875 22 0.20468758 23 -1.08531242 24 -1.50386731 25 -1.92242220 26 -2.29775338 27 -2.93775338 28 -3.57775338 29 -2.46386731 30 -0.26031010 31 3.75836985 32 5.48382609 33 4.47270983 34 2.12836985 35 0.81725359 36 0.45402988 37 0.42291362 38 0.77402988 39 1.48836985 40 1.45725359 41 0.87948611 42 0.70395115 43 -0.01729017 44 -0.60617391 45 -1.13604885 46 -0.18704005 47 0.16407621 48 -0.56716511 49 -1.93051389 50 -2.85051389 51 -2.93604885 52 -2.78691499 53 -2.65199604 54 -2.49691499 55 -2.42708638 56 -1.22031010 57 -1.05163015 58 0.50308501 59 0.28800396 60 -0.14592379 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1c3491256744507.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/2mig21256744507.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/3dadk1256744507.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/4dtfj1256744507.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/53c4j1256744507.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/6ysg31256744507.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/7h6eh1256744507.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/8xxql1256744507.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. 10.20 12.45 13.92 14.06 15.72 17.25 > > #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/9diw51256744507.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/10p2fd1256744507.tab") > > system("convert tmp/1c3491256744507.ps tmp/1c3491256744507.png") > system("convert tmp/2mig21256744507.ps tmp/2mig21256744507.png") > system("convert tmp/3dadk1256744507.ps tmp/3dadk1256744507.png") > system("convert tmp/4dtfj1256744507.ps tmp/4dtfj1256744507.png") > system("convert tmp/53c4j1256744507.ps tmp/53c4j1256744507.png") > system("convert tmp/6ysg31256744507.ps tmp/6ysg31256744507.png") > system("convert tmp/7h6eh1256744507.ps tmp/7h6eh1256744507.png") > system("convert tmp/8xxql1256744507.ps tmp/8xxql1256744507.png") > > > proc.time() user system elapsed 1.595 1.170 2.980