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(94.3,99.4,115.7,116.8,99.8,96.0,115.9,109.1,117.3,109.8,112.8,110.7,100.0,113.3,122.4,112.5,104.2,92.5,117.2,109.3,106.1,118.8,105.3,106.0,102.0,112.9,116.5,114.8,100.5,85.4,86.6,109.9,100.7,115.5,100.7,99.0,102.3,108.8,105.9,113.2,95.7,80.9,113.9,98.1,102.8,104.7,95.9,94.6,101.6,103.9,110.3,114.1,96.8,87.4,111.4,97.4,102.9,112.7,97.0,95.1,96.9,98.6,111.7,109.8,89.9,87.4,104.5,98.1,102.7,105.4,97.0,97.4) > x <- c(18.0,19.6,23.3,23.7,20.3,22.8,24.3,21.5,23.5,22.2,20.9,22.2,19.5,21.1,22.0,19.2,17.8,19.2,19.9,19.6,18.1,20.4,18.1,18.6,17.6,19.4,19.3,18.6,16.9,16.4,19.0,18.7,17.1,21.5,17.8,18.1,19.0,18.9,16.8,18.1,15.7,15.1,18.3,16.5,16.9,18.4,16.4,15.7,16.9,16.6,16.7,16.6,14.4,14.5,17.5,14.3,15.4,17.2,14.6,14.2,14.9,14.1,15.6,14.6,11.9,13.5,14.2,13.7,14.4,15.3,14.3,14.5) > 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 -10.1985515 2 -8.2072847 3 0.9037699 4 1.2265866 5 -9.1673555 6 -17.8247510 7 -0.8391884 8 -2.1989053 9 2.1151782 10 -2.8589761 11 2.6668696 12 -1.9589761 13 -7.4129889 14 2.7782780 15 10.1296155 16 5.6698986 17 0.0900401 18 -14.3301014 19 9.0098278 20 1.6927153 21 1.4071526 22 9.6383487 23 0.6071526 24 0.3356735 25 -1.7213683 26 5.6813069 27 9.4756028 28 9.1356735 29 -1.8612975 30 -15.9898184 31 -19.8415098 32 4.0413777 33 -2.0498891 34 4.2010947 35 -3.4099599 36 -5.6928474 37 -4.1415098 38 2.5527861 39 3.7329983 40 8.5071526 41 -4.3297476 42 -17.9639727 43 8.8185610 44 -3.4841142 45 0.4387025 46 -0.5757348 47 -5.4898184 48 -5.4297476 49 -0.7612975 50 2.1215900 51 8.3272942 52 12.3215900 53 -0.7039019 54 -10.2981977 55 7.8729276 56 0.0903939 57 3.4531398 58 9.7558150 59 -0.8924936 60 -2.0153103 61 -1.5753810 62 1.6789855 63 11.8645482 64 11.9075064 65 -2.7465064 66 -8.3552395 67 7.3846897 68 1.9561688 69 5.1960981 70 6.1474357 71 -0.3096061 72 -0.2981977 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1u19n1257349636.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/203uf1257349636.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/3man01257349636.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/4y3s71257349636.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/58vxi1257349636.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/6vvim1257349636.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/7pjw61257349636.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/8l5dm1257349636.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. 11.90 15.55 17.80 17.80 19.42 24.30 > > #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/9ge5g1257349636.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/10n4pf1257349636.tab") > > system("convert tmp/1u19n1257349636.ps tmp/1u19n1257349636.png") > system("convert tmp/203uf1257349636.ps tmp/203uf1257349636.png") > system("convert tmp/3man01257349636.ps tmp/3man01257349636.png") > system("convert tmp/4y3s71257349636.ps tmp/4y3s71257349636.png") > system("convert tmp/58vxi1257349636.ps tmp/58vxi1257349636.png") > system("convert tmp/6vvim1257349636.ps tmp/6vvim1257349636.png") > system("convert tmp/7pjw61257349636.ps tmp/7pjw61257349636.png") > system("convert tmp/8l5dm1257349636.ps tmp/8l5dm1257349636.png") > > > proc.time() user system elapsed 2.756 2.106 5.232