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(21.4,26.4,26.4,29.4,34.4,24.4,26.4,25.4,31.4,27.4,27.4,29.4,32.4,26.4,22.4,19.4,21.4,23.4,23.4,25.4,28.4,27.4,21.4,17.4,24.4,26.4,22.4,14.4,18.4,25.4,29.4,26.4,26.4,20.4,26.4,29.4,33.4,32.4,35.4,34.4,36.4,32.4,34.4,31.4,27.4,27.4,30.4,32.4,32.4,27.4,31.4,29.4,27.4,25.4,26.4,23.4,18.4,22.4,17.4,17.4,11.4,9.4,6.4,0,7.8,7.9,12,16.9,12.3) > x <- c(26.90,27.80,28.70,30.50,31.80,31.40,34.80,32.20,33.00,32.40,30.50,28.60,30.00,28.20,27.60,24.90,23.80,24.30,23.60,24.20,28.10,30.10,31.10,32.00,32.40,34.00,35.10,37.10,37.30,38.10,39.50,38.30,37.30,38.70,37.50,38.70,37.90,36.60,35.50,37.60,38.60,40.30,39.00,36.80,36.50,34.10,34.20,31.90,33.70,33.50,33.80,29.90,32.30,30.50,28.50,29.00,23.80,17.90,9.90,3.00,4.20,0.40,0.00,2.40,4.20,8.20,9.00,13.60,14.00) > par2 = '12' > 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.22534842 2 2.25756398 3 1.74047639 4 3.70630121 5 7.95939690 6 -1.81078639 7 -1.76422841 8 -1.27041980 9 4.26994678 10 0.61467184 11 1.70630121 12 4.79793057 13 6.99357209 14 2.02774728 15 -1.62752766 16 -3.07626488 17 -0.44426894 18 1.26846018 19 1.67063942 20 3.32591436 21 4.08520145 22 1.93611791 23 -4.63842386 24 -9.15551145 25 -2.38532816 26 -1.30459499 27 -5.93659094 28 -15.08567448 29 -11.20058283 30 -4.66021625 31 -1.46457472 32 -3.77512460 33 -3.20058283 34 -10.00494131 35 -3.31549118 36 -1.00494131 37 3.45469211 38 3.20159641 39 6.83359236 40 4.62705464 41 6.05251287 42 1.07579186 43 3.82269616 44 2.08668805 45 -1.74094941 46 -0.36204917 47 2.58049666 48 5.90194273 49 4.86776754 50 -0.01732410 51 3.81031336 52 4.05102627 53 0.67212602 54 -0.29369879 55 1.85538474 56 -1.43188614 57 -3.44426894 58 3.94552751 59 3.54186167 60 7.50619988 61 0.81674975 62 1.00000848 63 -1.77017481 64 -9.54907506 65 -2.78325025 66 -4.98141733 67 -1.34105074 68 0.91605712 69 -3.91375959 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1mjh91257359253.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/2n0g51257359253.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/3abtp1257359253.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/4anlq1257359253.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/5nn361257359253.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/6rj501257359253.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/7y11n1257359253.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/8lbon1257359253.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. 0.00 24.90 31.40 28.13 35.50 40.30 > > #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/9erz01257359253.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/107p8d1257359253.tab") > > system("convert tmp/1mjh91257359253.ps tmp/1mjh91257359253.png") > system("convert tmp/2n0g51257359253.ps tmp/2n0g51257359253.png") > system("convert tmp/3abtp1257359253.ps tmp/3abtp1257359253.png") > system("convert tmp/4anlq1257359253.ps tmp/4anlq1257359253.png") > system("convert tmp/5nn361257359253.ps tmp/5nn361257359253.png") > system("convert tmp/6rj501257359253.ps tmp/6rj501257359253.png") > system("convert tmp/7y11n1257359253.ps tmp/7y11n1257359253.png") > system("convert tmp/8lbon1257359253.ps tmp/8lbon1257359253.png") > > > proc.time() user system elapsed 1.920 1.680 3.986