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.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1) > x <- c(98.3,112.3,113.9,106.2,98.6,96.5,95.9,103.7,103.1,103.7,112.1,86.9,95,111.8,108.8,109.3,101.4,100.5,100.7,113.5,106.1,111.6,114.9,88.6,99.5,115.1,118,111.4,107.3,105.3,105.3,117.9,110.2,112.4,117.5,93,103.5,116.3,120,114.3,104.7,109.8,112.6,114.4,115.7,114.7,118.4,94.9,103.8,115.1,113.7,104,94.3,92.5,93.2,104.7,94,98.1,102.7,82.4) > 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.24923211 2 1.60530705 3 1.04600133 4 0.35016011 5 0.25686228 6 0.40345104 7 0.48819069 8 0.58657530 9 0.27131494 10 0.18657530 11 0.20022026 12 0.25928537 13 0.56530015 14 0.99259008 15 0.71628831 16 0.62900527 17 0.52807727 18 0.70518674 19 0.71027352 20 0.93582776 21 0.64761672 22 0.58750330 23 0.37143525 24 -0.09747696 25 0.07975281 26 0.47652204 27 0.45028042 28 0.18241652 29 0.07813743 30 0.12726958 31 0.12726958 32 0.34773702 33 0.25189581 34 0.00785044 35 -0.36243655 36 -0.68556769 37 -0.61851149 38 -0.59295726 39 -0.49885174 40 -0.64382510 41 -0.68799078 42 -0.45827776 43 -0.58706278 44 -0.84128171 45 -1.20821761 46 -1.53365153 47 -1.03954601 48 -0.43724324 49 -0.01088131 50 -0.12347796 51 -0.75908546 52 -1.30579453 53 -1.25250359 54 -0.49828466 55 -0.18048091 56 0.11200922 57 -0.46013377 58 -0.75585468 59 -0.53885863 60 -0.35516729 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/10gzb1256469577.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/2qj6b1256469577.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/3hul81256469577.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/4qtfz1256469577.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/5kvu41256469577.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/6w8941256469577.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/750jd1256469577.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/8i6rp1256469577.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. 82.40 99.28 105.70 105.70 113.60 120.00 > > #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/9tn6z1256469577.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/10llwe1256469577.tab") > > system("convert tmp/10gzb1256469577.ps tmp/10gzb1256469577.png") > system("convert tmp/2qj6b1256469577.ps tmp/2qj6b1256469577.png") > system("convert tmp/3hul81256469577.ps tmp/3hul81256469577.png") > system("convert tmp/4qtfz1256469577.ps tmp/4qtfz1256469577.png") > system("convert tmp/5kvu41256469577.ps tmp/5kvu41256469577.png") > system("convert tmp/6w8941256469577.ps tmp/6w8941256469577.png") > system("convert tmp/750jd1256469577.ps tmp/750jd1256469577.png") > system("convert tmp/8i6rp1256469577.ps tmp/8i6rp1256469577.png") > > > proc.time() user system elapsed 1.575 1.155 2.036