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(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(7974.49,8154.09,8299.21,8118.01,7516.89,7242.01,6955.56,6724,6464.16,6707.61,8798.44,8987.04,8519.29,7656.25,6922.24,6724,6448.09,6691.24,7242.01,7089.64,7123.36,7140.25,8704.89,8686.24,10060.09,12409.96,13202.01,11990.25,12078.01,11193.64,12276.64,11837.44,13479.21,12056.04,12950.44,12950.44,13782.76,14280.25,15030.76,14568.49,14161,15901.21,17929.21,19071.61,19712.16,21963.24,21963.24,24304.81,29275.21,29549.61,35645.44,46182.01,52212.25,48400,50805.16,48708.49,48268.09,53870.41,49952.25,47917.21) > 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 -2.28112508 2 2.44345369 3 -10.07909156 4 -1.00121670 5 -0.87938371 6 2.64215185 7 -9.61856970 8 -20.26346648 9 4.53500485 10 18.66166801 11 -4.14467362 12 -16.33389657 13 -10.11658991 14 -3.19309585 15 1.43252738 16 1.63653352 17 -2.44035139 18 2.58677182 19 -11.25784815 20 -27.52418483 21 6.22410468 22 12.19820343 23 -7.80121229 24 -15.07261203 25 -9.67944637 26 -10.08303250 27 11.00233844 28 5.66060359 29 -0.87397863 30 20.58222553 31 -7.37858285 32 -13.30505834 33 15.67724510 34 19.05971293 35 15.28812751 36 8.58812751 37 0.71174336 38 0.84882964 39 19.69790324 40 16.30680618 41 8.73170259 42 16.36304576 43 -13.54694445 44 -17.59884425 45 -4.48114417 46 1.26676671 47 13.06676671 48 -9.12409116 49 1.75367250 50 -1.16712696 51 32.58476082 52 0.02665951 53 5.47913124 54 39.32531475 55 -37.06306002 56 -23.54776261 57 -1.07239787 58 0.93630020 59 7.44489942 60 -21.83431436 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/16oxj1256289980.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/2for21256289980.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/3r2vt1256289980.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/4gm1d1256289980.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/5laxn1256289980.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/6d8bb1256289980.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/764di1256289981.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/8w3ok1256289981.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. 6448 7895 12180 18010 20270 53870 > > #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/92fdf1256289981.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/10zfo21256289981.tab") > > system("convert tmp/16oxj1256289980.ps tmp/16oxj1256289980.png") > system("convert tmp/2for21256289980.ps tmp/2for21256289980.png") > system("convert tmp/3r2vt1256289980.ps tmp/3r2vt1256289980.png") > system("convert tmp/4gm1d1256289980.ps tmp/4gm1d1256289980.png") > system("convert tmp/5laxn1256289980.ps tmp/5laxn1256289980.png") > system("convert tmp/6d8bb1256289980.ps tmp/6d8bb1256289980.png") > system("convert tmp/764di1256289981.ps tmp/764di1256289981.png") > system("convert tmp/8w3ok1256289981.ps tmp/8w3ok1256289981.png") > > > proc.time() user system elapsed 2.578 1.925 2.913