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(258596,259056,264193,260325,261890,260683,257941,258151,262434,261577,262188,261092,263571,265031,270388,265458,266218,266386,263486,263620,267755,266554,266981,264133,265980,267183,272113,267261,269117,269034,266609,267261,271406,269529,270282,268663,269847,270998,277068,273529,275307,276488,274455,274507,279528,277673,278102,275131,277162,278799,285502,280672,281342,281132,278286,279120,289131,294453,295733,302233,308859,311054,318130,315823,316517,316907,314969,316107) > x <- c(8.2,8,7.5,6.8,6.5,6.6,7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8,8.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 -14592.4691 2 -14749.8018 3 -11156.1334 4 -17184.7977 5 -16545.7966 6 -17444.1303 7 -17099.4671 8 -15654.8018 9 -11063.1354 10 -13154.8007 11 -13161.1334 12 -13948.4671 13 -10852.1344 14 -9392.1344 15 -4035.1344 16 -9891.1334 17 -9131.1334 18 -10197.7987 19 -11863.1334 20 -11729.1334 21 -7285.4671 22 -8177.8007 23 -7750.8007 24 -9981.4681 25 -7517.1354 26 -6005.4691 27 -1075.4691 28 -5927.4691 29 -4997.4681 30 -6932.4660 31 -10592.1313 32 -10866.1303 33 -6412.4640 34 -7672.1313 35 -6610.4650 36 -7920.7987 37 -6428.1324 38 -5585.7987 39 -133.1313 40 -3363.4650 41 -2202.7977 42 -2256.4630 43 -3363.4640 44 -3620.1303 45 783.5370 46 -1380.1293 47 -1259.7956 48 -3304.7966 49 -347.7977 50 1289.2023 51 6757.5370 52 1001.5381 53 745.5391 54 1461.5381 55 2010.8676 56 3153.5340 57 11929.8687 58 14782.5381 59 15136.5391 60 22871.2044 61 32275.2013 62 36322.1993 63 44015.5319 64 41091.1993 65 40859.2003 66 41557.8666 67 41163.1982 68 42609.8646 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1r8cg1257356049.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/2dybt1257356049.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/3wt8w1257356049.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/47dm61257356049.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/5zdng1257356049.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/6qys61257356049.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/7rlcf1257356049.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/8vnxz1257356049.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. 5.80 6.70 7.25 7.20 7.70 8.20 > > #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/9sre61257356049.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/104jjp1257356049.tab") > > system("convert tmp/1r8cg1257356049.ps tmp/1r8cg1257356049.png") > system("convert tmp/2dybt1257356049.ps tmp/2dybt1257356049.png") > system("convert tmp/3wt8w1257356049.ps tmp/3wt8w1257356049.png") > system("convert tmp/47dm61257356049.ps tmp/47dm61257356049.png") > system("convert tmp/5zdng1257356049.ps tmp/5zdng1257356049.png") > system("convert tmp/6qys61257356049.ps tmp/6qys61257356049.png") > system("convert tmp/7rlcf1257356049.ps tmp/7rlcf1257356049.png") > system("convert tmp/8vnxz1257356049.ps tmp/8vnxz1257356049.png") > > > proc.time() user system elapsed 2.576 1.919 2.987