R version 2.8.1 (2008-12-22) Copyright (C) 2008 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(123.21,118.81,100,84.64,84.64,90.25,92.16,90.25,82.81,79.21,81,102.01,106.09,104.04,92.16,84.64,86.49,88.36,88.36,84.64,81,81,81,96.04,100,96.04,86.49,81,81,82.81,82.81,82.81,84.64,77.44,68.89,70.56,65.61,59.29,62.41,62.41,64,62.41,57.76,50.41,46.24,42.25,47.61,67.24,75.69,68.89,62.41,56.25,60.84,68.89,70.56,67.24,59.29,51.84,53.29,65.61,72.25) > x <- c(65.61,64,56.25,54.76,59.29,62.41,59.29,50.41,38.44,33.64,37.21,47.61,53.29,51.84,37.21,33.64,37.21,39.69,46.24,46.24,42.25,38.44,39.69,40.96,43.56,57.76,40.96,46.24,49,47.61,50.41,51.84,50.41,49,47.61,44.89,43.56,47.61,53.29,62.41,67.24,67.24,67.24,65.61,62.41,59.29,59.29,57.76,56.25,56.25,50.41,56.25,56.25,60.84,60.84,60.84,57.76,56.25,59.29,65.61,64) > 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 53.2036260 2 47.9177882 3 24.8436621 4 8.6638495 5 11.1563000 6 18.4829546 7 18.6763000 8 11.8804368 9 -2.1455747 10 -8.3865818 11 -4.6323328 12 22.0998493 13 29.3050411 14 26.4572369 15 6.5276672 16 -2.9565818 17 0.8576672 18 4.0921876 19 7.6960619 20 3.9760619 21 -1.8592753 22 -3.9555747 23 -3.2678124 24 12.4709541 25 17.8614996 26 21.7144790 27 2.9209541 28 0.3360619 29 1.8546410 30 2.8998493 31 4.4404368 32 5.2272369 33 6.2704368 34 -1.7053590 35 -11.0201507 36 -10.8467214 37 -16.5285004 38 -20.6201507 39 -14.3749589 40 -9.3570454 41 -5.1095320 42 -6.6995320 43 -11.3495320 44 -19.5963740 45 -25.5270454 46 -31.2337000 47 -25.8737000 48 -7.0855210 49 0.5336621 50 -6.2663379 51 -15.9595632 52 -18.9063379 53 -14.3163379 54 -3.7408748 55 -2.0708748 56 -5.3908748 57 -15.0355210 58 -23.3163379 59 -20.1937000 60 -4.3963740 61 1.3577882 > library(lattice) > postscript(file="/var/www/rcomp/tmp/16ymm1256908930.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/rcomp/tmp/2kft21256908930.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/rcomp/tmp/3w7i91256908930.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/rcomp/tmp/4vw1d1256908930.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/rcomp/tmp/57wbw1256908930.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/rcomp/tmp/6ooeu1256908930.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/rcomp/tmp/73y8r1256908930.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/rcomp/tmp/8scqy1256908930.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. 33.64 46.24 53.29 52.27 59.29 67.24 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9soja1256908930.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/rcomp/tmp/10ckb11256908930.tab") > > system("convert tmp/16ymm1256908930.ps tmp/16ymm1256908930.png") > system("convert tmp/2kft21256908930.ps tmp/2kft21256908930.png") > system("convert tmp/3w7i91256908930.ps tmp/3w7i91256908930.png") > system("convert tmp/4vw1d1256908930.ps tmp/4vw1d1256908930.png") > system("convert tmp/57wbw1256908930.ps tmp/57wbw1256908930.png") > system("convert tmp/6ooeu1256908930.ps tmp/6ooeu1256908930.png") > system("convert tmp/73y8r1256908930.ps tmp/73y8r1256908930.png") > system("convert tmp/8scqy1256908930.ps tmp/8scqy1256908930.png") > > > proc.time() user system elapsed 1.990 1.600 3.306