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(3922,3759,4138,4634,3996,4308,4143,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > x <- c(8.274357007,8.231908244,8.327967858,8.441175705,8.29304914,8.368229038,8.329175442,8.395929104,8.560061092,8.502891407,8.657824321,8.629092284,8.333991247,8.509564164,8.557951184,8.466951975,8.409830673,8.653819789,8.653645315,8.525161361,8.716371865,8.497806478,8.58839695,8.626585568,8.43793351,8.461891876,8.519390775,8.575273402,8.329899293,8.43923165,8.462948177,8.347353412,8.540128163,8.344029572,8.323851131,8.537583881,8.366370302,8.429017501,8.245121966,8.617219505,8.35396813,8.250620082,8.387995253,8.481773246,8.391403185,8.427049642,8.320204598,8.475120415,8.272315148,8.240912542,8.390495538,8.29953457,8.318742253,8.473868067,8.059276223,8.184513753,8.269500767,8.337587942,8.259199363,8.339739766) > 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 11.5248032 2 43.2173006 3 -18.3629383 4 -41.5940512 5 -0.2072134 6 -33.0220221 7 -18.9015578 8 -39.0691878 9 -1.8653680 10 -29.6549298 11 85.7407129 12 54.5210439 13 -20.9893888 14 -27.2597256 15 -3.1882130 16 -38.8176701 17 -40.8291420 18 81.1076164 19 80.9078466 20 -20.7967274 21 164.2106840 22 -31.3327537 23 18.1713877 24 52.0181704 25 -41.7236287 26 -39.6093775 27 -23.3297654 28 8.3629257 29 -19.2215217 30 -41.6775859 31 -39.4541331 32 -26.2753507 33 -13.4424041 34 -25.0304610 35 -16.4814491 36 -14.7729800 37 -32.4968749 38 -41.8300918 39 32.6121768 40 42.9758932 41 -28.6139490 42 28.3949064 43 -37.6803473 44 -35.7958646 45 -38.3109274 46 -41.8044487 47 -14.7565185 48 -37.2824599 49 12.8898495 50 35.9188235 51 -38.1479778 52 -3.9528284 53 -14.0494302 54 -37.5385291 55 238.9991316 56 86.5935246 57 14.7980905 58 -22.4857360 59 22.0457823 60 -23.3551399 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/17qgj1256648781.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/2ej2x1256648781.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/3vx041256648781.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/4hhdn1256648781.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/5gh9y1256648781.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/6sf2i1256648781.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/7tzbl1256648781.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/8euo31256648781.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. 8.059 8.327 8.403 8.418 8.512 8.716 > > #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/98isz1256648781.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/10mk021256648781.tab") > > system("convert tmp/17qgj1256648781.ps tmp/17qgj1256648781.png") > system("convert tmp/2ej2x1256648781.ps tmp/2ej2x1256648781.png") > system("convert tmp/3vx041256648781.ps tmp/3vx041256648781.png") > system("convert tmp/4hhdn1256648781.ps tmp/4hhdn1256648781.png") > system("convert tmp/5gh9y1256648781.ps tmp/5gh9y1256648781.png") > system("convert tmp/6sf2i1256648781.ps tmp/6sf2i1256648781.png") > system("convert tmp/7tzbl1256648781.ps tmp/7tzbl1256648781.png") > system("convert tmp/8euo31256648781.ps tmp/8euo31256648781.png") > > > proc.time() user system elapsed 1.605 1.181 1.926