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(18.0,19.6,23.3,23.7,20.3,22.8,24.3,21.5,23.5,22.2,20.9,22.2,19.5,21.1,22.0,19.2,17.8,19.2,19.9,19.6,18.1,20.4,18.1,18.6,17.6,19.4,19.3,18.6,16.9,16.4,19.0,18.7,17.1,21.5,17.8,18.1,19.0,18.9,16.8,18.1,15.7,15.1,18.3,16.5,16.9,18.4,16.4,15.7,16.9,16.6,16.7,16.6,14.4,14.5,17.5,14.3,15.4,17.2,14.6,14.2,14.9,14.1,15.6,14.6,11.9,13.5,14.2,13.7,14.4,15.3,14.3,14.5) > x <- c(16.4,17.8,22.3,22.8,18.3,22.4,23.9,21.3,23.0,21.4,21.2,20.9,17.9,20.7,22.2,19.8,17.7,19.6,20.8,19.8,18.6,21.,18.6,18.9,17.3,20.0,19.9,19.5,16.2,17.6,19.8,19.4,17.2,21.1,17.8,17.5,18.0,19.1,17.7,19.2,15.1,16.3,18.6,17.2,17.8,19.1,16.6,16.0,16.7,17.4,17.9,17.8,13.9,15.9,17.9,15.4,16.4,17.9,15.3,14.6,14.9,15.0,16.7,16.3,11.7,15.1,15.5,15.0,15.4,16.0,14.7,14.8) > 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.99291709 2 2.06683417 3 0.86156764 4 0.71653803 5 2.22180456 6 0.25256172 7 0.11747288 8 0.15162687 9 0.29852618 10 0.74262095 11 -0.33936721 12 1.28765056 13 1.85782825 14 0.40566241 15 -0.32942644 16 -0.51328429 17 0.37584009 18 -0.29527244 19 -0.90334352 20 -0.11328429 21 -0.30521321 22 -0.62135536 23 -0.30521321 24 -0.13223098 25 0.61186378 26 -0.53129613 27 -0.52229021 28 -0.78626652 29 1.11092893 30 -0.91515399 31 -0.71328429 32 -0.57726060 33 0.22086971 34 0.36963872 35 0.26683417 36 0.89385194 37 1.24882232 38 -0.05024283 39 -0.62415991 40 -0.95924875 41 1.10999409 42 -0.79807699 43 -0.10521321 44 -0.37913029 45 -0.63316583 46 -0.55024283 47 0.17490524 48 0.12894078 49 0.56589932 50 -0.49714214 51 -0.94217175 52 -0.93316583 53 1.11806516 54 -0.96205330 55 -0.14217175 56 -0.61702368 57 -0.60708291 58 -0.44217175 59 -0.20801776 60 0.15502370 61 0.52800593 62 -0.38099999 63 -0.73410068 64 -1.29807699 65 1.01619546 66 -1.09000591 67 -0.82602961 68 -0.78099999 69 -0.51702368 70 -0.27105922 71 0.14601778 72 0.23701185 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1blne1258125157.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/27yuc1258125157.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/3w00w1258125157.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/40tus1258125157.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/5eu0u1258125157.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/6ofs41258125157.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/7vf8d1258125157.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/8mtz91258125157.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. 11.70 16.28 17.80 18.05 19.80 23.90 > > #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/9eixu1258125157.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/10qzwn1258125157.tab") > > system("convert tmp/1blne1258125157.ps tmp/1blne1258125157.png") > system("convert tmp/27yuc1258125157.ps tmp/27yuc1258125157.png") > system("convert tmp/3w00w1258125157.ps tmp/3w00w1258125157.png") > system("convert tmp/40tus1258125157.ps tmp/40tus1258125157.png") > system("convert tmp/5eu0u1258125157.ps tmp/5eu0u1258125157.png") > system("convert tmp/6ofs41258125157.ps tmp/6ofs41258125157.png") > system("convert tmp/7vf8d1258125157.ps tmp/7vf8d1258125157.png") > system("convert tmp/8mtz91258125157.ps tmp/8mtz91258125157.png") > > > proc.time() user system elapsed 1.667 1.242 2.032