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(2.079441542,2.091864062,2.041220329,2.014903021,2.028148247,2.054123734,2.054123734,2.054123734,2.014903021,2.014903021,1.960094784,2.014903021,2.014903021,2.028148247,2.041220329,2.041220329,2.066862759,2.091864062,2.104134154,2.104134154,2.104134154,2.066862759,1.987874348,1.931521412,1.887069649,1.902107526,1.931521412,1.945910149,1.960094784,1.974081026,1.960094784,1.931521412,1.945910149,1.916922612,1.85629799,1.902107526,1.887069649,1.85629799,1.840549633,1.824549292,1.871802177,1.916922612,1.916922612,1.85629799,1.808288771,1.757857918,1.808288771,1.974081026,1.987874348,1.931521412,1.808288771,1.757857918,1.824549292,1.960094784,2.041220329,2.066862759,2.041220329,2.00148,2.014903021,2.079441542) > x <- c(11.1,10.9,10,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.8,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8,7.9,7.6,7.1,6.8,6.5,6.9,8.2,8.7,8.3,7.9,7.5,7.8,8.3,8.4,8.2,7.7,7.2,7.3,8.1) > 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.022627608 2 0.001351680 3 0.002713403 4 0.022623168 5 0.035868394 6 0.044508729 7 0.038730345 8 0.044508729 9 0.028401552 10 0.039958320 11 -0.020628301 12 -0.029382289 13 -0.040939057 14 -0.021915447 15 0.025826940 16 0.048940476 17 0.068804522 18 0.088027441 19 0.100297533 20 0.111854301 21 0.123411069 22 0.086139674 23 0.007151263 24 -0.095428745 25 -0.151437277 26 -0.124842631 27 -0.066536825 28 -0.034812936 29 -0.020628301 30 -0.012420443 31 -0.026406685 32 -0.054980057 33 -0.046369704 34 -0.052243705 35 -0.083976406 36 -0.043945254 37 -0.041647979 38 -0.049306102 39 -0.076611227 40 -0.092611568 41 -0.051137067 42 -0.000238248 43 0.017096904 44 -0.014635797 45 -0.045309864 46 -0.078405565 47 -0.051088248 48 0.039585014 49 0.024486415 50 -0.008752984 51 -0.108872089 52 -0.136189406 53 -0.086833184 54 0.019820388 55 0.095167549 56 0.132366747 57 0.135616237 58 0.124767829 59 0.132412465 60 0.150723914 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1hpqn1256644828.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/2wig61256644828.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/3b2101256644828.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/4e6bl1256644828.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/5eecz1256644828.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/6rq561256644828.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/7ft6z1256644828.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/86q081256644828.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. 6.500 7.975 9.000 8.743 9.325 11.100 > > #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/9bkpt1256644828.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/10xia41256644828.tab") > > system("convert tmp/1hpqn1256644828.ps tmp/1hpqn1256644828.png") > system("convert tmp/2wig61256644828.ps tmp/2wig61256644828.png") > system("convert tmp/3b2101256644828.ps tmp/3b2101256644828.png") > system("convert tmp/4e6bl1256644828.ps tmp/4e6bl1256644828.png") > system("convert tmp/5eecz1256644828.ps tmp/5eecz1256644828.png") > system("convert tmp/6rq561256644828.ps tmp/6rq561256644828.png") > system("convert tmp/7ft6z1256644828.ps tmp/7ft6z1256644828.png") > system("convert tmp/86q081256644828.ps tmp/86q081256644828.png") > > > proc.time() user system elapsed 1.582 1.162 1.995