R version 2.8.0 (2008-10-20) 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(2.110170676,1.263534631,0.410170676,0.410170676,0.550078811,0.596714856,0.656806721,0.576990451,0.376990451,0.476990451,1.523626496,1.937082315,1.516898586,0.970262541,0.356806721,0.243350901,0.396714856,0.556806721,0.303442766,0.210170676,-0.003285144,-0.003285144,0.796714856,0.996714856,0.583259036,0.136622991,0.316898586,-0.056649099,-0.063377009,0.043350901,-0.116740964,-0.016740964,-0.363377009,-0.756649099,-0.603285144,-0.903285144,-1.356649099,-0.783101414,-0.996557234,-0.789829324,-1.049921189,-1.349921189,-1.636465369,-1.829737459,-2.023009549,-1.516281639,-0.323009549,0.070262541,0.09717418,-0.036006045,-0.27591418,-0.242733955,0.470721865,0.570721865,0.263993955,-0.39609791,-0.949461865,-0.90282582,-0.423009549,-0.023009549) > x <- c(0.918019272,0.523156338,0.318019272,0.418019272,0.602608074,0.597471008,0.612882206,0.343704602,0.343704602,-0.056295398,0.338567536,0.359115801,0.428293404,0.53343047,0.512882206,0.692333942,0.897471008,1.012882206,1.00774514,1.018019272,0.697471008,0.097471008,-0.302528992,-0.602528992,-0.523077256,-0.31794019,-0.171706596,-0.107666058,-0.01794019,-0.107666058,-0.323077256,-0.223077256,-0.41794019,-0.807666058,-0.502528992,-0.602528992,-0.807666058,-0.871706596,-0.99225486,-0.681980728,-0.397391926,-0.397391926,-0.776843662,-1.06656953,-1.356295398,-1.046021265,0.043704602,0.13343047,-0.225473001,-0.999787671,-1.284376473,-0.910061803,0.010486461,0.610486461,0.800212329,0.584801131,0.279664065,0.374526999,0.843704602,0.943704602) > 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.37132620 2 0.84248555 3 0.15422095 4 0.07373849 5 0.06508502 6 0.11585550 7 0.16354406 8 0.30036854 9 0.10036854 10 0.52229837 11 1.25113902 12 1.64805709 13 1.17219753 14 0.54094459 15 -0.05597348 16 -0.31385647 17 -0.32559187 18 -0.25838577 19 -0.50761529 20 -0.60915625 21 -0.56462695 22 -0.08173221 23 1.04019762 24 1.48164500 25 1.00424447 26 0.39250907 27 0.45509227 28 0.03000319 29 -0.04893830 30 0.13000319 31 0.14327955 32 0.16279709 33 -0.02700847 34 -0.10661961 35 -0.19883746 36 -0.41835500 37 -0.70661961 38 -0.08153052 39 -0.19796614 40 -0.24095447 41 -0.73009040 42 -1.03009040 43 -1.01124250 44 -0.97133609 45 -0.93142968 46 -0.67441802 47 -0.35818409 48 -0.03712558 49 0.27864039 50 0.76864764 51 0.75778357 52 0.48970615 53 0.46228210 54 0.07938736 55 -0.38003659 56 -0.86676023 57 -1.17454238 58 -1.20425435 59 -1.10204375 60 -0.78252621 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1n1jt1257357773.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/freestat/rcomp/tmp/2op981257357773.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/freestat/rcomp/tmp/3b6yc1257357773.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/freestat/rcomp/tmp/4w4291257357773.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/freestat/rcomp/tmp/5xtbo1257357773.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/freestat/rcomp/tmp/67g0n1257357773.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/freestat/rcomp/tmp/7ij6c1257357773.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/freestat/rcomp/tmp/81ddv1257357773.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. -1.356e+00 -5.077e-01 2.710e-02 -3.333e-11 5.463e-01 1.018e+00 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9fqav1257357773.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/freestat/rcomp/tmp/10wd7i1257357773.tab") > > system("convert tmp/1n1jt1257357773.ps tmp/1n1jt1257357773.png") > system("convert tmp/2op981257357773.ps tmp/2op981257357773.png") > system("convert tmp/3b6yc1257357773.ps tmp/3b6yc1257357773.png") > system("convert tmp/4w4291257357773.ps tmp/4w4291257357773.png") > system("convert tmp/5xtbo1257357773.ps tmp/5xtbo1257357773.png") > system("convert tmp/67g0n1257357773.ps tmp/67g0n1257357773.png") > system("convert tmp/7ij6c1257357773.ps tmp/7ij6c1257357773.png") > system("convert tmp/81ddv1257357773.ps tmp/81ddv1257357773.png") > > > proc.time() user system elapsed 2.549 1.906 3.738