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(-3.309,-7.848,-7.623,-0.690,-9.257,-7.994,-8.821,-9.128,-5.279,-2.897,-0.449,4.715,-1.789,-3.053,-0.316,-1.543,-1.068,-4.514,-0.368,-1.128,0.954,7.215,5.900,15.042,22.324,31.118,30.150,35.339,53.021,44.876,44.384,47.714,43.508,38.197,40.919,48.959,46.581,51.247,54.084,50.990,53.913,51.607,49.107,52.365,53.633,69.907,81.149,80.530,95.690,113.137,131.453,107.299,98.210,106.509,119.869,113.953,92.043,107.453,73.727,86.374) > x <- c(-20.286,-19.188,-12.489,12.524,-17.320,-18.183,-26.199,-7.417,-6.292,-6.022,-1.695,-0.368,-28.388,-18.524,-12.536,-11.631,-12.291,-8.682,-14.691,-17.360,-21.873,-14.531,-8.445,-1.836,10.500,17.897,18.312,44.853,82.821,57.647,44.737,44.705,64.243,39.752,46.444,67.940,51.209,57.739,74.377,56.231,48.788,42.781,28.965,41.528,27.437,47.397,54.387,56.079,75.792,127.288,184.410,127.691,116.945,118.555,149.008,150.618,80.590,77.625,70.009,79.853) > 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.7812140 2 -4.6028883 3 -9.5339359 4 -21.8527971 5 -7.4496398 6 -5.5224109 7 -0.1797024 8 -14.9427235 9 -11.9596070 10 -9.7854191 11 -10.6677994 12 -6.5251571 13 8.5371145 14 -0.3189520 15 -2.1907612 16 -4.1143164 17 -3.1313314 18 -9.3550857 19 -0.5841133 20 0.7101472 21 6.2656869 22 6.8757388 23 0.8765016 24 4.9317247 25 2.7190235 26 5.8197433 27 4.5323285 28 -10.7065948 29 -22.2475855 30 -11.0168068 31 -1.5723126 32 1.7823170 33 -17.4615779 34 -3.9224866 35 -6.3511465 36 -14.8560635 37 -4.3566441 38 -4.7166168 39 -14.6854564 40 -3.8129481 41 4.8387371 42 7.1561701 43 15.2899891 44 8.8785719 45 20.9920513 46 21.9033540 47 27.7653312 48 25.8440424 49 25.8314546 50 3.6433111 51 -22.0060194 52 -2.5048676 53 -3.3229484 54 3.7368761 55 -6.3420128 56 -13.4971883 57 18.4915577 58 36.1836418 59 8.3194806 60 13.3898076 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1p1pp1257943788.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/2xd711257943788.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/3k6461257943788.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/4fihs1257943788.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/5ps7c1257943788.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/683ta1257943788.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/7efeb1257943788.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/8tetq1257943788.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. -28.390 -9.419 40.640 36.520 65.170 184.400 > > #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/9vj9w1257943788.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/10fh7v1257943788.tab") > > system("convert tmp/1p1pp1257943788.ps tmp/1p1pp1257943788.png") > system("convert tmp/2xd711257943788.ps tmp/2xd711257943788.png") > system("convert tmp/3k6461257943788.ps tmp/3k6461257943788.png") > system("convert tmp/4fihs1257943788.ps tmp/4fihs1257943788.png") > system("convert tmp/5ps7c1257943788.ps tmp/5ps7c1257943788.png") > system("convert tmp/683ta1257943788.ps tmp/683ta1257943788.png") > system("convert tmp/7efeb1257943788.ps tmp/7efeb1257943788.png") > system("convert tmp/8tetq1257943788.ps tmp/8tetq1257943788.png") > > > proc.time() user system elapsed 1.601 1.176 2.456