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. Natural language support but running in an English locale 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.97,108.13,108.54,109.86,109.75,109.99,112.01,111.96,111.41,112.11,111.67,111.95,112.31,113.26,113.5,114.43,115.02,115.1,117.11,117.52,116.1,116.39,116.01,116.74,116.68,117.45,117.8,119.37,118.9,119.05,120.46,120.99,119.86,120.18,119.81,120.15,119.8,120.27,120.71,121.87,121.87,121.92,123.72,124.38,123.21,123.17,122.95,123.46,123.24,123.86,124.28,124.78,125.19,125.46,127.6,127.8,126.63,127.06,126.77,127.05) > x <- c(100.3,98.5,95.1,93.1,92.2,89,86.4,84.5,82.7,80.8,81.8,81.8,82.9,83.8,86.2,86.1,86.2,88.8,89.6,87.8,88.3,88.6,91,91.5,95.4,98.7,99.9,98.6,100.3,100.2,100.4,101.4,103,109.1,111.4,114.1,121.8,127.6,129.9,128,123.5,124,127.4,127.6,128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5) > par2 = '0' > 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 -8.48128334 2 -7.95259221 3 -6.84617564 4 -5.11651883 5 -5.04217327 6 -4.14672237 7 -1.59416852 8 -1.25499456 9 -1.43630343 10 -0.34712946 11 -0.99195787 12 -0.71195787 13 -0.57726911 14 0.18838533 15 -0.06320284 16 0.88728000 17 1.45679716 18 1.00424331 19 2.85038058 20 3.62907171 21 2.10665751 22 2.33520899 23 1.46362082 24 2.09120662 25 1.23237584 26 1.32644211 27 1.43064802 28 3.26692495 29 2.44871666 30 2.61919950 31 3.98823382 32 4.31340542 33 2.85567997 34 1.92622671 35 1.08512138 36 0.87208469 37 -1.05509402 38 -1.77309876 39 -1.80420409 40 -0.25503012 41 0.66669769 42 0.61428349 43 1.71786692 44 2.33690124 45 1.00303851 46 0.34855330 47 -0.62931179 48 0.10599945 49 -2.26469879 50 -2.21821832 51 -2.53560057 52 -1.58497808 53 0.32026926 54 1.10234027 55 3.05799471 56 2.06998997 57 0.42888464 58 0.73598760 59 -0.08656625 60 -1.11746804 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1j7831293028574.ps",horizontal=F,onefile=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/2j7831293028574.ps",horizontal=F,onefile=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/3bypn1293028574.ps",horizontal=F,onefile=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/4bypn1293028574.ps",horizontal=F,onefile=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/5bypn1293028574.ps",horizontal=F,onefile=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/647oq1293028574.ps",horizontal=F,onefile=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/747oq1293028574.ps",horizontal=F,onefile=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/8fg5b1293028574.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + acf(mylm$resid,lag.max=par2,main='Residual Autocorrelation Function') + grid() + dev.off() + } > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 80.80 88.95 100.40 110.80 130.30 157.50 > > #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/97qme1293028574.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/10l02n1293028574.tab") > > try(system("convert tmp/1j7831293028574.ps tmp/1j7831293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/2j7831293028574.ps tmp/2j7831293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/3bypn1293028574.ps tmp/3bypn1293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/4bypn1293028574.ps tmp/4bypn1293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/5bypn1293028574.ps tmp/5bypn1293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/647oq1293028574.ps tmp/647oq1293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/747oq1293028574.ps tmp/747oq1293028574.png",intern=TRUE)) character(0) > try(system("convert tmp/8fg5b1293028574.ps tmp/8fg5b1293028574.png",intern=TRUE)) convert: unable to open image `tmp/8fg5b1293028574.ps': No such file or directory. convert: missing an image filename `tmp/8fg5b1293028574.png'. character(0) > > > proc.time() user system elapsed 2.337 1.616 2.580