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(9,8.6,8.8,8.5,8.3,8.2,8,7.9,8,9.3,9.6,9,8.7,8.3,8.4,7.8,7.8,7.6,7.7,7.6,7.6,8.6,8.6,8.2,7.5,7.1,7,6.9,6.6,6.3,6.1,5.9,6,7.2,7.2,6.4,6.1,5.9,6.1,5.9,5.8,5.7,5.6,5.3,5.5,6.5,6.5,6.1,5.9,5.8,6.2,6.5,6.6,6.7,6.6,6.5,6.8,7.8,7.9,7.4) > x <- c(2.86,2.55,2.28,2.26,2.57,3.08,2.76,2.51,2.87,3.14,3.12,3.16,2.48,2.57,2.88,2.63,2.38,1.69,1.96,2.19,1.87,1.6,1.63,1.22,1.21,1.49,1.64,1.66,1.77,1.82,1.78,1.28,1.29,1.37,1.12,1.51,2.24,2.94,3.09,3.46,3.64,4.39,4.15,5.21,5.8,5.91,5.39,5.46,4.72,3.14,2.63,2.32,1.93,0.62,0.6,-0.37,-1.1,-1.68,-0.78,-1.19) > 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 1.88909680 2 1.43869533 3 1.59479727 4 1.29154556 5 1.14194704 6 1.12486559 7 0.87283826 8 0.73219191 9 0.89072266 10 2.23462072 11 2.53136901 12 1.93787243 13 1.52731435 14 1.14194704 15 1.29234851 16 0.65170216 17 0.61105581 18 0.29887188 19 0.44276994 20 0.38016458 21 0.32813725 22 1.28423919 23 1.28911675 24 0.82245674 25 0.12083088 26 -0.23364520 27 -0.30925739 28 -0.40600569 29 -0.68812129 30 -0.97999202 31 -1.18649544 32 -1.46778814 33 -1.36616229 34 -0.15315545 35 -0.19380181 36 -0.93039350 37 -1.11170615 38 -1.19789636 39 -0.97350855 40 -1.11335195 41 -1.18408658 42 -1.16214752 43 -1.30116802 44 -1.42882749 45 -1.13290210 46 -0.11501771 47 -0.19956212 48 -0.58818114 49 -0.90849434 50 -1.26537928 51 -0.94829784 52 -0.69869932 53 -0.66210763 54 -0.77509451 55 -0.87834622 56 -1.13605406 57 -0.95474141 58 -0.04904094 59 0.19728592 60 -0.36937410 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1rp6b1259752884.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/2h6sy1259752884.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/3a74w1259752884.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/4y2uz1259752884.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/5o12w1259752884.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/64u671259752884.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/74ux21259752884.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/8dv421259752884.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.680 1.578 2.300 2.312 3.082 5.910 > > #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/9mads1259752884.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/10sgly1259752884.tab") > > system("convert tmp/1rp6b1259752884.ps tmp/1rp6b1259752884.png") > system("convert tmp/2h6sy1259752884.ps tmp/2h6sy1259752884.png") > system("convert tmp/3a74w1259752884.ps tmp/3a74w1259752884.png") > system("convert tmp/4y2uz1259752884.ps tmp/4y2uz1259752884.png") > system("convert tmp/5o12w1259752884.ps tmp/5o12w1259752884.png") > system("convert tmp/64u671259752884.ps tmp/64u671259752884.png") > system("convert tmp/74ux21259752884.ps tmp/74ux21259752884.png") > system("convert tmp/8dv421259752884.ps tmp/8dv421259752884.png") > > > proc.time() user system elapsed 1.571 1.135 2.708