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(1.8,1.8,2.2,2.3,2.6,2.3,2.5,2.2,2.7,2.9,3.1,3,2.9,2.8,2.8,2.5,2.2,2.6,2.5,2.5,2.4,2.1,2,1.7,1.9,1.8,1.7,1.9,2,2,1.7,1.6,1.6,1.5,1.6,1.9,1.8,1.9,1.7,1.6,1.7,1.3,1.6,1.1,1.7,1.6,1.5,1.3,1.4,1.1,1.5,1.3,1.1,1.5,1.2,1.4,1.1,1.2,1.3,1.3) > x <- c(8.1,8,7.5,7.4,7.7,7.9,7.7,7.1,6.2,5.8,6.1,6.9,7.3,7.2,6.1,5.8,6.1,6.4,6.8,6.8,6.5,6.2,6.3,6.4,6.6,6.7,6.4,6.8,7,6.9,7.1,7.2,7.1,7,6.9,6.7,6.6,6.9,7.3,7.9,8.2,8.2,8.2,8.1,7.9,7.7,7.7,7.6,7.5,7.5,7.1,7.5,7.5,7.8,7.8,7.8,7.6,7.5,7.7,8.1) > 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.33517356 2 0.28857210 3 0.45556478 4 0.50896332 5 0.94876771 6 0.74197063 7 0.84876771 8 0.26915893 9 0.34974576 10 0.36333991 11 0.70314430 12 0.97595600 13 1.06236185 14 0.91576039 15 0.40314430 16 -0.03666009 17 -0.19685570 18 0.34294868 19 0.42935454 20 0.42935454 21 0.18955015 22 -0.25025424 23 -0.30365278 24 -0.55705132 25 -0.26384839 26 -0.31724693 27 -0.55705132 28 -0.17064546 29 0.02255746 30 -0.02404400 31 -0.23084107 32 -0.28423961 33 -0.33084107 34 -0.47744254 35 -0.42404400 36 -0.21724693 37 -0.36384839 38 -0.12404400 39 -0.13763815 40 0.04197063 41 0.28177502 42 -0.11822498 43 0.18177502 44 -0.36482644 45 0.14197063 46 -0.05123229 47 -0.15123229 48 -0.39783376 49 -0.34443522 50 -0.64443522 51 -0.43084107 52 -0.44443522 53 -0.64443522 54 -0.10463083 55 -0.40463083 56 -0.20463083 57 -0.59783376 58 -0.54443522 59 -0.35123229 60 -0.16482644 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1wjot1257437038.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/2ofos1257437038.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/3j2dd1257437038.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/44uct1257437038.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/5giym1257437038.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/6fue81257437038.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/7x4q11257437038.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/8ug9i1257437038.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. 5.800 6.700 7.200 7.173 7.700 8.200 > > #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/9gc4g1257437038.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/10alm61257437038.tab") > > system("convert tmp/1wjot1257437038.ps tmp/1wjot1257437038.png") > system("convert tmp/2ofos1257437038.ps tmp/2ofos1257437038.png") > system("convert tmp/3j2dd1257437038.ps tmp/3j2dd1257437038.png") > system("convert tmp/44uct1257437038.ps tmp/44uct1257437038.png") > system("convert tmp/5giym1257437038.ps tmp/5giym1257437038.png") > system("convert tmp/6fue81257437038.ps tmp/6fue81257437038.png") > system("convert tmp/7x4q11257437038.ps tmp/7x4q11257437038.png") > system("convert tmp/8ug9i1257437038.ps tmp/8ug9i1257437038.png") > > > proc.time() user system elapsed 1.643 1.214 95.149