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.653241965,2.602689685,2.4765384,2.681021529,2.747270914,2.646174797,2.701361213,2.653241965,2.681021529,2.844909384,2.734367509,2.660259537,2.862200881,2.674148649,2.667228207,2.809402695,2.815408719,2.809402695,2.827313622,2.753660712,2.797281335,2.912350665,2.827313622,2.803360381,2.90690106,2.714694744,2.753660712,2.895911938,2.821378886,2.939161922,2.944438979,2.895911938,2.879198457,3.068052935,2.839078464,2.928523524,2.944438979,2.797281335,2.827313622,2.923161581,2.960105096,2.965273066,2.867898902,2.923161581,2.895911938,3.015534901,2.895911938,2.975529566,2.990719732,2.954910279,2.879198457,2.954910279,3.091042453,3.04927304,2.970414466,3.100092289,3.039749159,3.100092289,3.157000421,3.068052935,3.19047635,3.126760536,3.010620886,3.165475048,3.148453361,2.975529566,2.890371758,2.850706502,2.821378886,2.901421594,2.803360381,2.772588722,2.912350665) > x <- c(2.740840024,2.714694744,2.459588842,2.791165108,2.815408719,2.708050201,2.701361213,2.681021529,2.727852828,2.884800713,2.797281335,2.734367509,2.884800713,2.766319109,2.63188884,2.879198457,2.884800713,2.856470206,2.815408719,2.772588722,2.809402695,2.949688335,2.879198457,2.844909384,2.923161581,2.791165108,2.714694744,2.954910279,2.87356464,2.949688335,2.890371758,2.862200881,2.879198457,3.04927304,2.844909384,2.965273066,2.985681938,2.867898902,2.785011242,2.970414466,2.990719732,2.995732274,2.850706502,2.939161922,2.923161581,3.063390922,2.923161581,2.985681938,3.034952987,2.975529566,2.87356464,2.985681938,3.100092289,3.0301337,2.884800713,3.039749159,3.054001182,3.063390922,3.135494216,3.058707073,3.173878459,3.109060959,2.90690106,3.126760536,3.104586678,2.879198457,2.797281335,2.772588722,2.797281335,2.87356464,2.809402695,2.785011242,2.90690106) > 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.0670210258 2 -0.0898509744 3 0.0544913198 4 -0.0926020935 5 -0.0520586646 6 -0.0393205286 7 0.0229583470 8 -0.0035943521 9 -0.0254708940 10 -0.0279978291 11 -0.0457412639 12 -0.0531405246 13 -0.0107063321 14 -0.0731302942 15 0.0624882029 16 -0.0575643409 17 -0.0574984941 18 -0.0334651495 19 0.0279840434 20 -0.0002660196 21 0.0043200564 22 -0.0293581124 23 -0.0396534139 24 -0.0272493068 25 -0.0066809020 26 -0.0589288785 27 0.0611200526 28 -0.0513337647 29 -0.0396145079 30 -0.0025468554 31 0.0656246822 32 0.0469677512 33 0.0122314211 34 0.0207526245 35 0.0084687762 36 -0.0297100364 37 -0.0354344917 38 -0.0577045705 39 0.0602150592 40 -0.0405235024 41 -0.0251100423 42 -0.0252569647 43 0.0311424211 44 -0.0073858430 45 -0.0176700240 46 -0.0467348649 47 -0.0176700240 48 -0.0043439047 49 -0.0413967574 50 -0.0141984410 51 0.0182050631 52 -0.0249631917 53 -0.0101424617 54 0.0222665312 55 0.0975072529 56 0.0628903284 57 -0.0125644893 58 0.0378225231 59 0.0182781782 60 0.0107495421 61 0.0110545735 62 0.0160659721 63 0.1142802599 64 0.0360132902 65 0.0425029612 66 0.1085625301 67 0.1102629851 68 0.0967797704 69 0.0412701131 70 0.0404282001 71 0.0103991024 72 0.0054901592 73 0.0160100389 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1tk701256545539.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/2tmtw1256545539.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/3h5dv1256545539.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/4ebuq1256545539.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/5sedj1256545539.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/6gfp71256545539.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/7pu6c1256545539.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/81k851256545539.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. 2.460 2.797 2.879 2.890 2.986 3.174 > > #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/9tewu1256545539.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/10tazz1256545539.tab") > > system("convert tmp/1tk701256545539.ps tmp/1tk701256545539.png") > system("convert tmp/2tmtw1256545539.ps tmp/2tmtw1256545539.png") > system("convert tmp/3h5dv1256545539.ps tmp/3h5dv1256545539.png") > system("convert tmp/4ebuq1256545539.ps tmp/4ebuq1256545539.png") > system("convert tmp/5sedj1256545539.ps tmp/5sedj1256545539.png") > system("convert tmp/6gfp71256545539.ps tmp/6gfp71256545539.png") > system("convert tmp/7pu6c1256545539.ps tmp/7pu6c1256545539.png") > system("convert tmp/81k851256545539.ps tmp/81k851256545539.png") > > > proc.time() user system elapsed 1.566 1.168 2.678