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(1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5,3.6,4.4,4.1,5.1,5.8,5.9,5.4,5.5,4.8,3.2,2.7,2.1,1.9,0.6,0.7,-0.2,-1,-1.7) > x <- c(27.1,27.1,24.1,24.1,24.1,21.3,21.3,21.3,19.1,19.1,19.1,26.2,26.2,26.2,21.7,21.7,21.7,19.4,19.4,19.4,19.5,19.5,19.5,28.7,28.7,28.7,21.8,21.8,21.8,20,20,20,22.6,22.6,22.6,22.4,22.4,22.4,18.6,18.6,18.6,16.2,16.2,16.2,13.8,13.8,13.8,24.1,24.1,24.1,19.9,19.9,19.9,22.3,22.3,22.3,20.9,20.9,20.9) > 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.16354625 2 1.06354625 3 0.22855757 4 -0.17144243 5 -0.07144243 6 -0.17743186 7 0.32256814 8 -0.07743186 9 -0.49642356 10 -0.09642356 11 -0.09642356 12 1.13304965 13 1.23304965 14 0.43304965 15 -0.11943337 16 0.38056663 17 0.38056663 18 0.04707531 19 -0.55292469 20 -0.15292469 21 0.06157493 22 -0.23842507 23 -0.33842507 24 0.89554021 25 0.49554021 26 0.29554021 27 -0.40493375 28 -0.30493375 29 -0.70493375 30 -0.86592696 31 -0.86592696 32 -0.86592696 33 -0.98893677 34 -0.98893677 35 -0.98893677 36 -1.11793602 37 -0.91793602 38 -0.11793602 39 0.03107832 40 0.23107832 41 0.63107832 42 0.38308738 43 1.18308738 44 0.88308738 45 1.53509644 46 2.23509644 47 2.33509644 48 3.32855757 49 3.42855757 50 2.72855757 51 0.51957342 52 0.01957342 53 -0.58042658 54 -0.43243564 55 -1.73243564 56 -1.63243564 57 -2.73543036 58 -3.53543036 59 -4.23543036 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1mpcm1256894994.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/268pp1256894994.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/3bs261256894994.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/4mtwm1256894994.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/5ze9t1256894994.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/6q1mh1256894994.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/7dx901256894994.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/8mt3h1256894994.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. 13.80 19.45 21.30 21.39 22.60 28.70 > > #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/9uqpx1256894994.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/10m8vg1256894994.tab") > > system("convert tmp/1mpcm1256894994.ps tmp/1mpcm1256894994.png") > system("convert tmp/268pp1256894994.ps tmp/268pp1256894994.png") > system("convert tmp/3bs261256894994.ps tmp/3bs261256894994.png") > system("convert tmp/4mtwm1256894994.ps tmp/4mtwm1256894994.png") > system("convert tmp/5ze9t1256894994.ps tmp/5ze9t1256894994.png") > system("convert tmp/6q1mh1256894994.ps tmp/6q1mh1256894994.png") > system("convert tmp/7dx901256894994.ps tmp/7dx901256894994.png") > system("convert tmp/8mt3h1256894994.ps tmp/8mt3h1256894994.png") > > > proc.time() user system elapsed 2.430 1.782 2.768