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(-11.764,-11.664,-10.178,-10.378,-10.278,-9.176,-9.176,-9.176,-10.132,-10.132,-10.532,-10.542,-10.542,-10.442,-11.408,-11.408,-11.208,-9.45,-9.35,-9.35,-7.628,-7.928,-8.528,-8.272,-8.572,-8.472,-9.01,-8.91,-8.81,-7.726,-7.826,-8.026,-7.024,-7.224,-7.624,-9.21,-9.31,-9.51,-7.806,-7.906,-7.606,-7.716,-7.716,-8.116,-6.776,-7.076,-6.776,-11.088,-10.988,-11.388,-7.842,-8.142,-7.742,-9.712,-9.112,-8.912,-8.538,-8.838,-8.738,-8.238,-8.138) > x <- c(25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24) > 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.776754825 2 -0.639988829 3 0.147457243 4 -0.677564692 5 -0.834926666 6 0.046477357 7 -0.063820631 8 -0.100586628 9 -1.019820631 10 -1.240416609 11 -1.750714597 12 -0.437138734 13 -0.290074749 14 -0.190074749 15 -1.376670727 16 -1.744330689 17 -1.691394673 18 -0.301054635 19 -0.311352624 20 -0.605480593 21 1.042987414 22 0.595923429 23 -0.004076571 24 1.649031285 25 1.606393258 26 1.596095270 27 0.469839330 28 0.018349388 29 -0.286076571 30 0.724391437 31 0.550859445 32 0.424391437 33 1.904349388 34 1.446987414 35 0.752859445 36 0.159541342 37 -0.161054635 38 -0.875778582 39 0.460561456 40 -0.043864502 41 0.292901494 42 0.293199483 43 0.072603505 44 -0.878886438 45 0.093453600 46 -0.537440365 47 0.461113562 48 -1.350798696 49 -0.662542757 50 -1.614032700 51 0.939285403 52 -0.426928487 53 0.230433486 54 -0.820416609 55 0.294307338 56 0.604605327 57 0.647711361 58 -0.203778582 59 0.080051399 60 2.013925251 61 2.297755232 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1byxa1257268838.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/2w0m71257268838.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/32n0h1257268838.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/4mi6e1257268838.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/50b2f1257268838.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/6j3un1257268838.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/7ra2b1257268838.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/8cs7u1257268838.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. 13.40 18.80 20.20 20.18 22.00 25.60 > > #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/9i4l31257268838.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/10656n1257268838.tab") > > system("convert tmp/1byxa1257268838.ps tmp/1byxa1257268838.png") > system("convert tmp/2w0m71257268838.ps tmp/2w0m71257268838.png") > system("convert tmp/32n0h1257268838.ps tmp/32n0h1257268838.png") > system("convert tmp/4mi6e1257268838.ps tmp/4mi6e1257268838.png") > system("convert tmp/50b2f1257268838.ps tmp/50b2f1257268838.png") > system("convert tmp/6j3un1257268838.ps tmp/6j3un1257268838.png") > system("convert tmp/7ra2b1257268838.ps tmp/7ra2b1257268838.png") > system("convert tmp/8cs7u1257268838.ps tmp/8cs7u1257268838.png") > > > proc.time() user system elapsed 2.581 1.948 3.117