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(14.44,22.09,18.49,15.21,16,18.49,23.04,19.36,18.49,22.09,22.09,24.01,25,17.64,18.49,23.04,23.04,23.04,17.64,21.16,23.04,20.25,19.36,18.49,15.21,13.69,16,16.81,13.69,14.44,14.44,14.44,10.89,10.89,10.89,10.24,11.56,17.64,24.01,26.01,30.25,31.36,40.96,37.21,50.41,60.84,62.41,54.76,56.25,46.24,27.04,22.09,16.81,15.21,6.76,7.29,3.24,1,0.09,1.69) > x <- c(161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137) > 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 0.5782047 2 5.9861367 3 0.5177466 4 -3.5096094 5 -3.6538044 6 -1.7243214 7 1.8914835 8 -2.7227115 9 -4.5269065 10 -0.7400675 11 5.9861367 12 9.4008487 13 10.3908487 14 1.1624586 15 0.1440686 16 3.7598736 17 2.4520005 18 2.0783225 19 -4.4427115 20 -1.4832285 21 -0.1637455 22 -2.7669065 23 2.3219416 24 2.5729757 25 -0.8938633 26 -5.2164484 27 -4.9616775 28 -5.4595505 29 -8.3927115 30 -8.7637455 31 -9.8847796 32 -10.4452966 33 -15.3031696 34 -15.6768476 35 -9.8848385 36 -9.4138044 37 -9.2148385 38 -4.8163895 39 -0.1279405 40 1.6852204 41 5.9252204 42 6.2878644 43 14.7668304 44 10.6431524 45 22.1616013 46 33.1521184 47 40.1404495 48 33.2378055 49 34.1672885 50 22.6625765 51 2.7152204 52 -1.8611015 53 -6.7674235 54 -8.3674235 55 -17.0042625 56 -16.6611015 57 -22.2058136 58 -23.6984576 59 -19.3769654 60 -16.6559314 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1szkq1256670370.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/2dld11256670370.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/31cdj1256670370.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/49dik1256670370.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/5u1re1256670370.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/6ptzk1256670370.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/7ircc1256670370.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/8sjqi1256670370.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. 84.0 106.8 116.5 119.5 131.2 161.0 > > #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/9j1281256670370.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/105nzk1256670370.tab") > > system("convert tmp/1szkq1256670370.ps tmp/1szkq1256670370.png") > system("convert tmp/2dld11256670370.ps tmp/2dld11256670370.png") > system("convert tmp/31cdj1256670370.ps tmp/31cdj1256670370.png") > system("convert tmp/49dik1256670370.ps tmp/49dik1256670370.png") > system("convert tmp/5u1re1256670370.ps tmp/5u1re1256670370.png") > system("convert tmp/6ptzk1256670370.ps tmp/6ptzk1256670370.png") > system("convert tmp/7ircc1256670370.ps tmp/7ircc1256670370.png") > system("convert tmp/8sjqi1256670370.ps tmp/8sjqi1256670370.png") > > > proc.time() user system elapsed 1.632 1.167 8.572