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(7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5) > x <- c(10.35713947,10.30547997,10.42945791,10.57438912,10.42531246,10.13038405,10.84821024,10.72753141,10.86891125,10.79063779,10.63933496,10.81144365,10.39656663,10.41568224,10.48136416,10.51959169,10.48237361,9.950943494,10.97767053,10.91426995,11.09041592,10.85069539,10.84242001,10.75023526,10.48301801,10.41190027,10.46860248,10.63748873,10.45923874,9.962228048,10.93535444,10.80427879,10.99747248,10.78109982,10.76789534,10.82966921,10.59810865,10.43848858,10.51488223,10.74410601,10.50717491,10.0804615,10.95563697,10.94002938,10.96226694,11.0397167,10.79812555,10.84286962,10.58749308,10.41069664,10.54867797,10.67570004,10.32875529,9.99679573,10.77964355,10.7396089,10.834391,10.78132847,10.55555229,10.69448713) > 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.471804600 2 0.878914356 3 0.961851610 4 0.541905122 5 0.362422137 6 0.503012331 7 0.604219866 8 0.620828565 9 0.601370842 10 0.312143406 11 0.332966803 12 -0.090720048 13 0.366378347 14 0.363747518 15 0.454707894 16 0.549446743 17 0.554568966 18 0.827708247 19 0.886402599 20 0.995128248 21 0.970885757 22 1.003877842 23 0.705016760 24 0.117703896 25 -0.245519721 26 -0.535731980 27 -0.443535751 28 -0.266779106 29 -0.142247045 30 0.026155184 31 -0.007773553 32 -0.089733968 33 -0.316322690 34 -0.186543909 35 -0.384726613 36 -0.793228382 37 -0.461359333 38 -0.539391257 39 -0.749905107 40 -0.881452552 41 -0.948844369 42 -0.590116964 43 -0.410564982 44 -0.408416952 45 -0.811477447 46 -1.122136647 47 -1.388887114 48 -1.095045119 49 0.040101659 50 0.164433672 51 -0.254556323 52 -1.072038025 53 -1.324288963 54 -0.878602272 55 -0.086343487 56 0.519166373 57 0.706121770 58 0.513424622 59 0.244497583 60 0.325376359 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1d8241256816673.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/23ksv1256816673.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/36r0o1256816673.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/4jqi61256816673.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/5duna1256816673.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/6cdbt1256816673.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/7ne0y1256816673.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/82g5c1256816673.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. 9.951 10.450 10.660 10.620 10.830 11.090 > > #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/9q7w41256816673.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/10i1ty1256816673.tab") > > system("convert tmp/1d8241256816673.ps tmp/1d8241256816673.png") > system("convert tmp/23ksv1256816673.ps tmp/23ksv1256816673.png") > system("convert tmp/36r0o1256816673.ps tmp/36r0o1256816673.png") > system("convert tmp/4jqi61256816673.ps tmp/4jqi61256816673.png") > system("convert tmp/5duna1256816673.ps tmp/5duna1256816673.png") > system("convert tmp/6cdbt1256816673.ps tmp/6cdbt1256816673.png") > system("convert tmp/7ne0y1256816673.ps tmp/7ne0y1256816673.png") > system("convert tmp/82g5c1256816673.ps tmp/82g5c1256816673.png") > > > proc.time() user system elapsed 1.790 1.490 3.275