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(107.25,105.80,102.90,100.00,98.55,108.70,110.14,113.04,115.94,117.39,118.84,120.29,118.84,115.94,114.49,110.14,110.14,120.29,121.74,121.74,121.74,121.74,124.64,128.99,127.54,120.29,108.70,104.35,107.25,127.54,134.78,134.78,126.09,118.84,120.29,123.19,124.64,123.19,118.84,117.39,114.49,124.64,126.09,126.09,123.19,121.74,123.19,126.09,126.09,124.64,123.19,120.29,115.94,118.84,117.39,117.39,115.94,114.49,114.49,115.94,115.94,114.49,115.94,111.59,104.35,108.70,105.80,101.45,101.45,101.45,104.35,105.80,102.90,98.55,92.75,88.41,94.20,111.59,114.49,108.70,100.00,95.65,100.00,111.59,115.94) > x <- c(105.9,117.6,113.6,115.9,118.9,77.6,81.2,123.1,136.6,112.1,95.1,96.3,105.7,115,105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.7,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105,109,129.4,148.6,101.4,134.8,143.7,81.6,90.3,141.5,140.7,140.2,100.2,125.7,119.6,134.7,109,116.3,146.9,97.4,89.4,132.1,139.8,129,112.5,121.9,121.7,123.1,131.6,119.3,132.5,98.3,85.1,131.7,129.3,90.7,78.6,68.9,79.1) > 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 -7.5509044 2 -8.3188729 3 -11.4520461 4 -14.2179715 5 -15.4930916 6 -7.7506046 7 -6.1007487 8 -0.7582598 9 2.9286996 10 2.9505140 11 3.4095280 12 4.9294800 13 4.0274369 14 1.6695645 15 -0.3225631 16 -4.6725631 17 -4.3577793 18 4.1192032 19 4.2634335 20 7.0207062 21 6.5543598 22 7.3821246 23 10.0139754 24 13.8568238 25 12.6225090 26 7.4011156 27 -5.2673104 28 -10.7831762 29 -5.3765646 30 10.6988303 31 18.7724244 32 21.5588438 33 13.0786996 34 4.7386151 35 5.5124129 36 9.3451056 37 10.9816441 38 10.8665605 39 5.2282787 40 2.2218478 41 1.7002141 42 8.3467873 43 10.5137948 44 13.1894569 45 8.6805620 46 7.7377137 47 8.3366316 48 11.4698048 49 12.6589879 50 12.3282191 51 8.1267758 52 7.1737717 53 3.3425820 54 2.6225686 55 1.6797202 56 4.6643368 57 3.1677021 58 1.6885555 59 -0.6431762 60 2.2933028 61 1.9377137 62 1.3679424 63 1.3198048 64 -2.6046542 65 -8.0608795 66 -6.5963974 67 -9.9627438 68 -11.8236202 69 -11.3747618 70 -12.0043294 71 -10.0661687 72 -8.0682118 73 -10.9798704 74 -15.2482598 75 -20.5527668 76 -25.6097743 77 -19.0503029 78 -3.6539335 79 -1.5234049 80 -4.5969375 81 -13.4368414 82 -20.0369625 83 -16.3923113 84 -5.3677562 85 -0.4231647 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1lw5f1258126451.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/2j1t61258126451.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/3inhc1258126451.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/4nuyh1258126451.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/59hf41258126451.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/65d641258126451.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/7n1lz1258126451.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/8dxld1258126451.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. 60.0 99.6 113.6 112.9 129.4 148.6 > > #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/9u9wa1258126452.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/10bngv1258126452.tab") > > system("convert tmp/1lw5f1258126451.ps tmp/1lw5f1258126451.png") > system("convert tmp/2j1t61258126451.ps tmp/2j1t61258126451.png") > system("convert tmp/3inhc1258126451.ps tmp/3inhc1258126451.png") > system("convert tmp/4nuyh1258126451.ps tmp/4nuyh1258126451.png") > system("convert tmp/59hf41258126451.ps tmp/59hf41258126451.png") > system("convert tmp/65d641258126451.ps tmp/65d641258126451.png") > system("convert tmp/7n1lz1258126451.ps tmp/7n1lz1258126451.png") > system("convert tmp/8dxld1258126451.ps tmp/8dxld1258126451.png") > > > proc.time() user system elapsed 1.643 1.209 2.485