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(101.3,106.3,94,102.8,102,105.1,92.4,81.4,105.8,120.3,100.7,88.8,94.3,99.9,103.4,103.3,98.8,104.2,91.2,74.7,108.5,114.5,96.9,89.6,97.1,100.3,122.6,115.4,109,129.1,102.8,96.2,127.7,128.9,126.5,119.8,113.2,114.1,134.1,130,121.8,132.1,105.3,103,117.1,126.3,138.1,119.5,138,135.5,178.6,162.2,176.9,204.9,132.2,142.5,164.3,174.9,175.4,143) > x <- c(89.3,90.3,91.1,90.1,86.7,85.1,83.4,82,80.4,81.9,93.8,94.8,92.3,87.5,83.2,82,80.3,81.8,85.1,84.2,84.4,84.5,93.3,93.2,100.3,111.4,114.9,109.5,109.9,105.8,110.8,108.8,116.1,109.8,113.8,113.8,117.4,119.5,122.6,120.7,119,126.1,133.9,138.1,140.4,148.2,148.2,155.9,171.1,171.9,188.8,214.9,228.5,220,225.4,220.7,219.7,232.1,223.5,218.9) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = 'Retail prices in importing Member countries in US cents per lb (Arabica, 1977/1 - 2006/12)' > par5 = 'www.ico.org' > par4 = 'usa' > par3 = 'Prices paid to growers in exporting Member countries in US cents per lb (Arabica, 1977/1 - 2006/12)' > par2 = '36' > par1 = '0' > ylab = '' > xlab = '' > main = '' > #'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.4578192 2 4.0667628 3 -8.6135716 4 0.6618464 5 1.4782676 6 5.3389364 7 -6.5528530 8 -16.8872678 9 8.2734010 10 22.0602740 11 -3.1972002 12 -15.5726182 13 -8.8840732 14 -1.0020668 15 4.5422306 16 5.0127322 17 1.3209428 18 6.0078158 19 -8.5610636 20 -24.6331874 21 9.0717290 22 15.0241872 23 -6.7594912 24 -14.0119494 25 -9.8874172 26 -11.9645569 27 8.6714801 28 4.0387373 29 -2.5514299 30 19.4977839 31 -9.1793061 32 -14.8284701 33 13.2009785 34 17.3961119 35 13.0944399 36 6.3944399 37 -1.9170649 38 -2.0154427 39 16.5107615 40 13.3140557 41 5.9222663 42 12.8467985 43 -17.6614618 44 -21.9582174 45 -8.9516788 46 -3.4599392 47 8.3400608 48 -13.9206578 49 -2.6470113 50 -5.5273457 51 29.5380901 52 0.7296804 53 8.9639957 54 41.0050486 55 -34.2622085 56 -21.7277440 57 0.5476740 58 5.2524909 59 9.8410856 60 -20.3719916 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1xxkl1257863971.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/2n91w1257863971.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/3gp1x1257863971.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/4k8nu1257863971.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/5skmo1257863971.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/6a9921257863971.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/7fjd41257863971.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/8hhlg1257863971.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. 80.30 88.85 110.40 125.50 142.40 232.10 > > #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/9qyxg1257863971.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/10x8rh1257863971.tab") > > system("convert tmp/1xxkl1257863971.ps tmp/1xxkl1257863971.png") > system("convert tmp/2n91w1257863971.ps tmp/2n91w1257863971.png") > system("convert tmp/3gp1x1257863971.ps tmp/3gp1x1257863971.png") > system("convert tmp/4k8nu1257863971.ps tmp/4k8nu1257863971.png") > system("convert tmp/5skmo1257863971.ps tmp/5skmo1257863971.png") > system("convert tmp/6a9921257863971.ps tmp/6a9921257863971.png") > system("convert tmp/7fjd41257863971.ps tmp/7fjd41257863971.png") > system("convert tmp/8hhlg1257863971.ps tmp/8hhlg1257863971.png") > > > proc.time() user system elapsed 1.634 1.177 2.431