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(8.1,8.0,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.0,6.9,7.1,7.2,7.1,7.0,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,8.0) > x <- c(8.1,8.0,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.0,6.9,7.1,7.2,7.1,7.0,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,8.0) > 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.382797e-16 2 -9.970118e-16 3 3.491070e-17 4 1.060457e-17 5 2.562262e-19 6 1.321352e-16 7 2.562262e-19 8 -6.802664e-18 9 -1.739100e-17 10 5.191794e-17 11 -6.376276e-20 12 2.785181e-17 13 1.578874e-17 14 3.625677e-18 15 -6.376276e-20 16 5.191794e-17 17 -6.376276e-20 18 -5.204547e-17 19 -1.033211e-17 20 -1.033211e-17 21 4.164960e-17 22 -1.739100e-17 23 -3.471823e-17 24 -5.204547e-17 25 2.432236e-17 26 -1.040272e-16 27 -5.204547e-17 28 -1.033211e-17 29 1.052457e-17 30 2.785181e-17 31 -6.802664e-18 32 3.625677e-18 33 -6.802664e-18 34 1.052457e-17 35 2.785181e-17 36 -1.040272e-16 37 2.432236e-17 38 2.785181e-17 39 1.578874e-17 40 1.321352e-16 41 -3.086880e-17 42 -3.086880e-17 43 -3.086880e-17 44 9.748074e-17 45 1.321352e-16 46 2.562262e-19 47 2.562262e-19 48 1.758346e-17 49 3.491070e-17 50 3.491070e-17 51 -6.802664e-18 52 3.491070e-17 53 3.491070e-17 54 3.844014e-17 55 3.844014e-17 56 3.844014e-17 57 1.758346e-17 58 3.491070e-17 59 2.562262e-19 60 9.748074e-17 61 1.148080e-16 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1nq2l1256745041.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/2rfse1256745041.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/3o52e1256745041.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/43hty1256745041.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/5wmmx1256745041.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/6ocgr1256745041.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/7ydf21256745041.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/8rhul1256745041.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.187 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/93iqi1256745041.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/10kizg1256745041.tab") > > system("convert tmp/1nq2l1256745041.ps tmp/1nq2l1256745041.png") > system("convert tmp/2rfse1256745041.ps tmp/2rfse1256745041.png") > system("convert tmp/3o52e1256745041.ps tmp/3o52e1256745041.png") > system("convert tmp/43hty1256745041.ps tmp/43hty1256745041.png") > system("convert tmp/5wmmx1256745041.ps tmp/5wmmx1256745041.png") > system("convert tmp/6ocgr1256745041.ps tmp/6ocgr1256745041.png") > system("convert tmp/7ydf21256745041.ps tmp/7ydf21256745041.png") > system("convert tmp/8rhul1256745041.ps tmp/8rhul1256745041.png") > > > proc.time() user system elapsed 1.606 1.165 2.718