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(7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5) > x <- c(31.481,29.896,33.842,39.120,33.702,25.094,51.442,45.594,52.518,48.564,41.745,49.585,32.747,33.379,35.645,37.034,35.681,20.972,58.552,54.955,65.540,51.570,51.145,46.641,35.704,33.253,35.193,41.668,34.865,21.210,56.126,49.231,59.723,48.103,47.472,50.497,40.059,34.149,36.860,46.356,36.577,23.872,57.276,56.389,57.657,62.300,48.929,51.168,39.636,33.213,38.127,43.291,30.600,21.956,48.033,46.148,50.736,48.114,38.390,44.112) > 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.47583314 2 0.88167630 3 0.96712922 4 0.54767168 5 0.36764534 6 0.49937906 7 0.60224615 8 0.62380503 9 0.59827944 10 0.31285601 11 0.33799451 12 -0.09090794 13 0.37116598 14 0.36883609 15 0.46048240 16 0.55536179 17 0.56034968 18 0.81457497 19 0.87603487 20 0.98929535 21 0.95027334 22 1.00177428 23 0.70334106 24 0.11994522 25 -0.23973511 26 -0.53069941 27 -0.43785129 28 -0.26172162 29 -0.13664211 30 0.01369757 31 -0.01502159 32 -0.08960291 33 -0.32828207 34 -0.18544450 35 -0.38311829 36 -0.79427007 37 -0.45578998 38 -0.53400254 39 -0.74399675 40 -0.87900411 41 -0.94295346 42 -0.59611599 43 -0.41926111 44 -0.41599115 45 -0.82066568 46 -1.13778228 47 -1.38848958 48 -1.09674373 49 0.04576942 50 0.16944806 51 -0.24866759 52 -1.06770487 53 -1.32091902 54 -0.88905259 55 -0.08518644 56 0.52176269 57 0.70484885 58 0.51451495 59 0.25036285 60 0.32926848 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/11ezt1256816216.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/2xjr61256816216.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/3h98n1256816216.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/4qbhw1256816216.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/5geht1256816216.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/6gug81256816216.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/7lgyu1256816216.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/8t62c1256816216.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. 20.97 34.69 42.52 42.56 50.56 65.54 > > #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/9ebt21256816216.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/10rezq1256816216.tab") > > system("convert tmp/11ezt1256816216.ps tmp/11ezt1256816216.png") > system("convert tmp/2xjr61256816216.ps tmp/2xjr61256816216.png") > system("convert tmp/3h98n1256816216.ps tmp/3h98n1256816216.png") > system("convert tmp/4qbhw1256816216.ps tmp/4qbhw1256816216.png") > system("convert tmp/5geht1256816216.ps tmp/5geht1256816216.png") > system("convert tmp/6gug81256816216.ps tmp/6gug81256816216.png") > system("convert tmp/7lgyu1256816216.ps tmp/7lgyu1256816216.png") > system("convert tmp/8t62c1256816216.ps tmp/8t62c1256816216.png") > > > proc.time() user system elapsed 1.610 1.175 2.140