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(101.3,106.3,94,102.8,102,105.1,92.4,81.4,105.8,120.3,100.7,88.8,94.3,99.9,103.4,103.3,98.8,104.2,91.2,74.7,108.5,114.5,96.9,89.6,97.1,100.3,122.6,115.4,109,129.1,102.8,96.2,127.7,128.9,126.5,119.8,113.2,114.1,134.1,130,121.8,132.1,105.3,103,117.1,126.3,138.1,119.5,138,135.5,178.6,162.2,176.9,204.9,132.2,142.5,164.3,174.9,175.4,143) > x <- c(4.492001488,4.50313746,4.511957804,4.500920165,4.462453884,4.443827036,4.423648309,4.406719247,4.387014176,4.405498991,4.541164856,4.551769409,4.525044142,4.471638793,4.421247348,4.406719247,4.385769621,4.404277244,4.443827036,4.433194921,4.435567402,4.436751534,4.535820108,4.534747722,4.608165695,4.713127327,4.744062185,4.695924549,4.699570861,4.661550519,4.707726774,4.689511334,4.754451889,4.698660529,4.734442522,4.734442522,4.765586907,4.783316371,4.808927024,4.793308128,4.779123493,4.837075243,4.897093253,4.92797806,4.944495492,4.998562713,4.998562713,5.049214776,5.142248181,5.146912912,5.240688254,5.370172804,5.43153621,5.393627546,5.417876602,5.396804313,5.392262979,5.447168313,5.409411414,5.388615005) > 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.8450440 2 5.1060723 3 -7.7792366 4 1.7532098 5 3.5057925 6 7.8418509 7 -3.5191096 8 -13.3957145 9 12.3118937 10 25.5852604 11 -3.0173864 12 -15.6210936 13 -8.3476325 14 0.7962914 15 7.6402157 16 8.5042855 17 5.3944811 18 9.5663343 19 -6.0581491 20 -21.8526129 21 11.7899517 22 17.7113739 23 -6.4627145 24 -13.6915520 25 -11.0634930 26 -14.8286387 27 5.4185561 28 1.4129199 29 -5.2290456 30 17.3939451 31 -11.9702635 32 -17.3615057 33 9.8291060 34 14.7313631 35 9.9569070 36 3.2569070 37 -5.4098023 38 -5.6863112 39 12.6141922 40 9.5506461 41 2.2919238 42 8.7463055 43 -22.0364278 44 -26.3859117 45 -13.3819915 46 -7.7698365 47 4.0301635 48 -17.9310552 49 -5.6046560 50 -8.4142027 51 28.4629623 52 3.4705011 53 14.0984888 54 44.6140686 55 -29.6950737 56 -17.9967383 57 4.1046199 58 11.0611586 59 14.0666674 60 -16.9533043 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/10b6h1256289608.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/2w8xe1256289608.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/3jgo21256289608.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/4qwdl1256289608.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/5uw1c1256289608.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/6da571256289608.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/7tmt61256289608.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/8rl4t1256289608.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. 4.386 4.487 4.704 4.771 4.958 5.447 > > #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/9iole1256289608.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/1028tz1256289608.tab") > > system("convert tmp/10b6h1256289608.ps tmp/10b6h1256289608.png") > system("convert tmp/2w8xe1256289608.ps tmp/2w8xe1256289608.png") > system("convert tmp/3jgo21256289608.ps tmp/3jgo21256289608.png") > system("convert tmp/4qwdl1256289608.ps tmp/4qwdl1256289608.png") > system("convert tmp/5uw1c1256289608.ps tmp/5uw1c1256289608.png") > system("convert tmp/6da571256289608.ps tmp/6da571256289608.png") > system("convert tmp/7tmt61256289608.ps tmp/7tmt61256289608.png") > system("convert tmp/8rl4t1256289608.ps tmp/8rl4t1256289608.png") > > > proc.time() user system elapsed 1.602 1.187 5.273