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(108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,104.7,130.9,129.2,113.5,125.6,107.6,107,121.6,110.7,106.3,118.6,104.6) > x <- c(103.5,102.8,118.72,119.01,118.61,120.43,111.83,116.79,131.71,120.57,117.83,130.8,107.46,112.09,129.47,119.72,134.81,135.8,129.27,126.94,153.45,121.86,133.47,135.34,117.1,120.65,132.49,137.6,138.69,125.53,133.09,129.08,145.94,129.07,139.69,142.09,137.29,127.03,137.25,156.87,150.89,139.14,158.3,149,158.36,168.06,153.38,173.86,162.47,145.17,168.89,166.64,140.07,128.84,123.41,120.3,129.67,118.1,113.91,131.09) > 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 -7.61643099 2 12.00745118 3 4.16430232 4 2.55440828 5 11.76805524 6 -8.29403841 7 -11.20062885 8 2.93014889 9 -6.07888258 10 -6.39881485 11 3.19466680 12 -19.84783575 13 -8.85153586 14 10.59050062 15 -0.10245962 16 2.83018493 17 -1.28464649 18 -6.51842271 19 -4.89563615 20 13.38385737 21 -9.02059465 22 1.75717372 23 6.46107081 24 -15.90272871 25 -4.08042750 26 10.99845576 27 12.19450586 28 8.22016599 29 1.88297804 30 -1.46803711 31 -3.82596458 32 12.41084616 33 -5.86437305 34 -0.48881267 35 9.34886064 36 -5.63302109 37 -3.36925762 38 3.88078681 39 14.03210708 40 6.76272387 41 2.36674587 42 0.06762521 43 -0.78606399 44 2.63122774 45 9.21188896 46 -6.31904973 47 6.38179357 48 -3.61693059 49 -13.72833351 50 13.06189734 51 10.55263284 52 -5.07060303 53 7.93589604 54 -9.68096567 55 -10.09570824 56 4.61039685 57 -6.60928310 58 -10.61454489 59 1.82840697 60 -12.75772980 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1am1i1256914811.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/20l5p1256914811.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/34o2j1256914811.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/475v91256914811.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/5rk9b1256914811.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/6we1c1256914811.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/7xd0o1256914811.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/872hr1256914811.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. 102.8 120.4 130.9 133.4 140.6 173.9 > > #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/96rwe1256914811.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/106fh01256914811.tab") > system("convert tmp/1am1i1256914811.ps tmp/1am1i1256914811.png") > system("convert tmp/20l5p1256914811.ps tmp/20l5p1256914811.png") > system("convert tmp/34o2j1256914811.ps tmp/34o2j1256914811.png") > system("convert tmp/475v91256914811.ps tmp/475v91256914811.png") > system("convert tmp/5rk9b1256914811.ps tmp/5rk9b1256914811.png") > system("convert tmp/6we1c1256914811.ps tmp/6we1c1256914811.png") > system("convert tmp/7xd0o1256914811.ps tmp/7xd0o1256914811.png") > system("convert tmp/872hr1256914811.ps tmp/872hr1256914811.png") > > > proc.time() user system elapsed 2.687 2.038 3.110