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(5.7,6.1,6,5.9,5.8,5.7,5.6,5.4,5.4,5.5,5.6,5.7,5.9,6.1,6,5.8,5.8,5.7,5.5,5.3,5.2,5.2,5,5.1,5.1,5.2,4.9,4.8,4.5,4.5,4.4,4.4,4.2,4.1,3.9,3.8,3.9,4.2,4.1,3.8,3.6,3.7,3.5,3.4,3.1,3.1,3.1,3.2,3.3,3.5,3.6,3.5,3.3,3.2,3.1,3.2,3,3,3.1,3.4) > x <- c(97.33,97.89,98.69,99.01,99.18,98.45,98.13,98.29,99.1,99.26,98.85,98.05,98.53,99.34,100.14,100.3,100.22,99.9,99.58,99.9,100.78,100.78,100.46,100.06,100.28,100.78,101.58,102.06,102.02,101.68,101.32,101.81,102.3,102.12,102.1,101.75,101.5,102.16,103.47,104.05,104.09,103.55,102.77,102.89,103.6,103.76,103.92,103.35,103.32,104.2,105.44,105.81,106.25,105.94,105.82,105.96,106.49,106.32,105.88,105.07) > 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.50440047 2 0.10795757 3 0.31132621 4 0.33267367 5 0.29713950 6 -0.07968438 7 -0.30103183 8 -0.44035811 9 -0.13319736 10 0.02747637 11 -0.02800006 12 -0.23136870 13 0.15065248 14 0.65781323 15 0.86118187 16 0.72185560 17 0.69151874 18 0.47017128 19 0.14882382 20 0.07017128 21 0.30387678 22 0.30387678 23 -0.01747067 24 -0.06915499 25 0.01427138 26 0.30387678 27 0.30724542 28 0.38926661 29 0.07409818 30 -0.05483350 31 -0.29134938 32 -0.10553609 33 -0.11972280 34 -0.28798074 35 -0.49556496 36 -0.72828874 37 -0.72309144 38 -0.17281231 39 0.22395384 40 0.14389610 41 -0.04093547 42 -0.14570930 43 -0.64149372 44 -0.69598843 45 -0.72674876 46 -0.66607503 47 -0.60540130 48 -0.72155146 49 -0.63292778 50 -0.09922228 51 0.47099911 52 0.51130711 53 0.47815986 54 0.26060451 55 0.11509921 56 0.26818873 57 0.26917045 58 0.20470461 59 0.13785186 60 0.13069111 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1qhnu1257249446.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/2ylc51257249446.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/3brzh1257249446.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/4nwxi1257249446.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/5bit71257249446.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/6ha301257249446.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/757zg1257249446.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/8hg661257249446.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. 97.33 99.82 101.70 101.80 103.60 106.50 > > #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/9c0of1257249446.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/10d3n31257249446.tab") > > system("convert tmp/1qhnu1257249446.ps tmp/1qhnu1257249446.png") > system("convert tmp/2ylc51257249446.ps tmp/2ylc51257249446.png") > system("convert tmp/3brzh1257249446.ps tmp/3brzh1257249446.png") > system("convert tmp/4nwxi1257249446.ps tmp/4nwxi1257249446.png") > system("convert tmp/5bit71257249446.ps tmp/5bit71257249446.png") > system("convert tmp/6ha301257249446.ps tmp/6ha301257249446.png") > system("convert tmp/757zg1257249446.ps tmp/757zg1257249446.png") > system("convert tmp/8hg661257249446.ps tmp/8hg661257249446.png") > > > proc.time() user system elapsed 1.575 1.160 2.177