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(4,3.8,4.7,4.3,3.9,4,4.3,4.8,4.4,4.3,4.7,4.7,4.9,5,4.2,4.3,4.8,4.8,4.8,4.2,4.6,4.8,4.5,4.4,4.3,3.9,3.7,4,4.1,3.7,3.8,3.8,3.8,3.3,3.3,3.3,3.2,3.4,4.2,4.9,5.1,5.5,5.6,6.4,6.1,7.1,7.8,7.9,7.4,7.5,6.8,5.2,4.7,4.1,3.9,2.6,2.7,1.8,1,0.3) > 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.37500824 2 1.34727462 3 0.87207590 4 0.31660867 5 0.36114143 6 0.57500824 7 0.71660867 8 0.68594271 9 0.33047547 10 0.21660867 11 0.07207590 12 0.77207590 13 0.89980952 14 0.91367633 15 0.60274186 16 0.51660867 17 0.68594271 18 0.88594271 19 0.88594271 20 0.70274186 21 0.65820909 22 0.48594271 23 0.14434228 24 0.33047547 25 0.21660867 26 0.16114143 27 0.03340781 28 -0.02499176 29 -0.01112495 30 0.03340781 31 0.04727462 32 -0.05272538 33 0.04727462 34 -0.32205942 35 -0.82205942 36 -0.52205942 37 -0.73592623 38 -1.00819261 39 -0.89725814 40 -0.80019048 41 -0.57245686 42 -0.41698963 43 -0.60312282 44 -0.79218835 45 -1.23378877 46 -1.39512068 47 -0.89805302 48 0.31581379 49 0.44647974 50 0.06034655 51 -0.63672111 52 -1.15859005 53 -0.92792410 54 -0.21112495 55 0.06114143 56 -0.11912709 57 -0.40526028 58 -0.93006156 59 -0.94099603 60 -0.33806369 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1rjcb1261143819.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/2l2cs1261143819.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/3kio91261143819.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/4i54q1261143820.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/5op2z1261143820.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/6tvv91261143820.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/7e58h1261143820.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/84nof1261143820.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. 0.300 3.800 4.300 4.457 4.825 7.900 > > #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/9eoij1261143820.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/109pud1261143820.tab") > > try(system("convert tmp/1rjcb1261143819.ps tmp/1rjcb1261143819.png",intern=TRUE)) character(0) > try(system("convert tmp/2l2cs1261143819.ps tmp/2l2cs1261143819.png",intern=TRUE)) character(0) > try(system("convert tmp/3kio91261143819.ps tmp/3kio91261143819.png",intern=TRUE)) character(0) > try(system("convert tmp/4i54q1261143820.ps tmp/4i54q1261143820.png",intern=TRUE)) character(0) > try(system("convert tmp/5op2z1261143820.ps tmp/5op2z1261143820.png",intern=TRUE)) character(0) > try(system("convert tmp/6tvv91261143820.ps tmp/6tvv91261143820.png",intern=TRUE)) character(0) > try(system("convert tmp/7e58h1261143820.ps tmp/7e58h1261143820.png",intern=TRUE)) character(0) > try(system("convert tmp/84nof1261143820.ps tmp/84nof1261143820.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.634 1.194 4.982