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(286.525,282.965,276.61,277.838,277.051,277.026,274.96,270.073,267.063,264.916,287.182,291.109,292.223,288.109,281.4,282.579,280.113,280.331,276.759,275.139,274.275,271.234,289.725,290.649,292.223,278.429,269.749,265.784,268.957,264.099,255.121,253.276,245.98,235.295,258.479,260.916,254.586,250.566,243.345,247.028,248.464,244.962,237.003,237.008,225.477,226.762,247.857,248.256,246.892,245.021,246.186,255.688,264.242,268.27,272.969,273.886,267.353,271.916,292.633,295.804) > x <- c(581,597,587,536,524,537,536,533,528,516,502,506,518,534,528,478,469,490,493,508,517,514,510,527,542,565,555,499,511,526,532,549,561,557,566,588,620,626,620,573,573,574,580,590,593,597,595,612,628,629,621,569,567,573,584,589,591,595,594,611) > 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 25.5503614 2 25.5319512 3 16.9634575 4 6.9026401 5 3.4594478 6 6.3119895 7 4.0246401 8 -1.5264080 9 -5.6431548 10 -10.4463471 11 8.7207618 12 13.5331593 13 17.3033516 14 16.7309414 15 8.6938452 16 -1.1946228 17 -5.6527671 18 -0.7864305 19 -3.6943824 20 -1.9941420 21 -0.8659977 22 -4.5710458 23 13.0345567 24 17.7214959 25 22.6157363 26 13.9127716 27 3.0192780 28 -13.3412862 29 -7.5120939 30 -9.0498535 31 -16.6997573 32 -14.7818182 33 -19.4216258 34 -30.9920233 35 -5.8158790 36 1.4908069 37 2.2439865 38 -0.4479174 39 -8.9970135 40 -15.7174335 41 -14.2814335 42 -17.5620842 43 -24.1929880 44 -21.9744944 45 -32.8414463 46 -30.6710488 47 -10.0187476 48 -5.8568084 49 -3.6792186 50 -5.3288693 51 -5.9346642 52 -7.9428310 53 0.1684703 54 5.5245665 55 12.6584095 56 14.6821563 57 8.5918550 58 14.0402524 59 34.5359031 60 41.4698422 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1ck6z1257178709.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/23f2f1257178709.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/3qkap1257178709.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/4qxqs1257178709.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/5cb811257178709.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/6ulsd1257178709.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/7jtr21257178709.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/85eny1257178709.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. 469.0 525.5 563.0 557.1 590.2 629.0 > > #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/9n3ea1257178709.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/10vq251257178709.tab") > system("convert tmp/1ck6z1257178709.ps tmp/1ck6z1257178709.png") > system("convert tmp/23f2f1257178709.ps tmp/23f2f1257178709.png") > system("convert tmp/3qkap1257178709.ps tmp/3qkap1257178709.png") > system("convert tmp/4qxqs1257178709.ps tmp/4qxqs1257178709.png") > system("convert tmp/5cb811257178709.ps tmp/5cb811257178709.png") > system("convert tmp/6ulsd1257178709.ps tmp/6ulsd1257178709.png") > system("convert tmp/7jtr21257178709.ps tmp/7jtr21257178709.png") > system("convert tmp/85eny1257178709.ps tmp/85eny1257178709.png") > > > proc.time() user system elapsed 2.703 2.023 3.597