R version 2.8.1 (2008-12-22) 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(31.394,29.799,33.728,39.010,33.598,24.992,51.347,45.498,52.413,48.461,41.647,49.471,32.666,33.283,35.532,36.928,35.572,20.870,58.453,54.854,65.425,51.469,51.035,46.526,35.619,33.153,35.078,41.552,34.752,21.108,56.020,49.126,59.604,47.997,47.363,50.380,39.967,34.045,36.748,46.234,36.464,23.772,57.165,56.276,57.547,62.183,48.820,51.052,39.540,33.113,38.010,43.175,30.501,21.862,47.942,46.055,50.633,48.020,38.298,44.009) > x <- c(79.8,88.8,106,102.6,96.4,94,86.8,88.1,96.9,95.3,90.6,106.8,73.4,88.2,105.6,98.2,101.1,94.4,90.9,92.5,107.3,92.5,102,107.3,78.5,93.9,108.1,109.6,105.9,94.9,98.8,98.2,111.9,99.1,102.5,110.8,85.8,97.6,106.1,116.1,107.1,93.5,103.9,106,103.4,111.2,103.3,109.8,88.8,92.5,109.9,109.6,93.6,88.1,83.9,85.5,95.2,86.4,84.4,95.2) > 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 -4.4863041 2 -9.4087200 3 -11.8387815 4 -5.2997577 5 -8.4195378 6 -16.1382269 7 12.8787058 8 6.5490790 9 10.2106057 10 6.8501463 11 1.7737968 12 3.6084482 13 -0.8481417 14 -5.7028923 15 -9.8868963 16 -5.7550210 17 -8.1831884 18 -20.4081121 19 18.4688830 20 14.2783424 21 19.3775918 22 10.8933424 23 6.9470700 24 0.4785918 25 0.2193226 26 -7.9402557 27 -11.2651785 28 -5.3457478 29 -10.7778102 30 -20.3549685 31 13.1151512 32 6.4429790 33 11.8559126 34 4.9812374 35 3.0902136 36 3.0385967 37 1.8684186 38 -8.4161933 39 -8.8557527 40 -3.0668815 41 -9.5094656 42 -17.1733705 43 12.3746156 44 10.7092185 45 12.9414720 46 14.6937116 47 4.2514433 48 4.0803096 49 0.3322800 50 -7.4626576 51 -8.9986617 52 -3.7227478 53 -10.4813418 54 -17.0869210 55 10.5458731 56 8.0673325 57 9.0591176 58 9.6995909 59 0.7170167 60 2.4351176 > library(lattice) > postscript(file="/var/www/rcomp/tmp/10iur1257968008.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/rcomp/tmp/2sj8p1257968008.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/rcomp/tmp/33vpc1257968008.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/rcomp/tmp/4bopo1257968008.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/rcomp/tmp/56zcv1257968008.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/rcomp/tmp/6aa0w1257968008.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/rcomp/tmp/7vchk1257968008.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/rcomp/tmp/85rvk1257968008.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. 73.40 90.83 97.25 97.58 106.00 116.10 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/95hxn1257968008.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/rcomp/tmp/10m0zy1257968008.tab") > > system("convert tmp/10iur1257968008.ps tmp/10iur1257968008.png") > system("convert tmp/2sj8p1257968008.ps tmp/2sj8p1257968008.png") > system("convert tmp/33vpc1257968008.ps tmp/33vpc1257968008.png") > system("convert tmp/4bopo1257968008.ps tmp/4bopo1257968008.png") > system("convert tmp/56zcv1257968008.ps tmp/56zcv1257968008.png") > system("convert tmp/6aa0w1257968008.ps tmp/6aa0w1257968008.png") > system("convert tmp/7vchk1257968008.ps tmp/7vchk1257968008.png") > system("convert tmp/85rvk1257968008.ps tmp/85rvk1257968008.png") > > > proc.time() user system elapsed 1.950 1.750 3.443