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.96,1.44,1,2.89,5.76,4,4.41,4,3.24,7.29,5.29,3.61,4,5.29,7.84,5.76,5.29,7.29,7.29,8.41,9,4.84,5.29,7.84,7.84,7.84,4.84,6.76,7.84,6.25,5.76,5.29,3.61,2.89,4,4.41,2.89,3.24,3.24,3.24,1.69,1.69,1.69,1.44,1.96,4.84,8.41,9.61,12.25,12.96,19.36,16.81,26.01,33.64,34.81,29.16,30.25,23.04,10.24,7.29,4.41,3.61,0.36,0.49,0.04,1,2.89,0.49,1) > x <- c(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4.8841,5.0625,5.0625,6.0025,6.25,6.25,6.9696,7.5625,8.5849,9,10.0489,10.5625,11.4921,12.25,12.25,13.3225,14.0625,14.0625,15.21,16,16,16,16,16,16,16,16,16,16,16,16,17.4724,18.0625,18.0625,15.7609,11.6964,7.5625,5.3361,4,2.7556,1.7161,1.1881,1,1,1,1) > 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 -1.91365475 2 -2.43365475 3 -2.87365475 4 -0.98365475 5 1.88634525 6 0.12634525 7 0.53634525 8 0.12634525 9 -0.63365475 10 3.41634525 11 1.41634525 12 -0.26365475 13 0.12634525 14 1.41634525 15 3.96634525 16 1.88634525 17 1.41634525 18 3.41634525 19 3.41634525 20 4.53634525 21 5.12634525 22 0.96634525 23 1.41634525 24 3.25448520 25 3.11084100 26 3.11084100 27 -0.64602864 28 1.07468920 29 2.15468920 30 -0.01471867 31 -0.98211017 32 -2.27532668 33 -4.28955710 34 -5.85411089 35 -5.15765158 36 -5.49614735 37 -7.62639363 38 -7.27639363 39 -8.13994968 40 -8.73578323 41 -10.28578323 42 -11.20972782 43 -11.84582039 44 -12.09582039 45 -11.57582039 46 -8.69582039 47 -5.12582039 48 -3.92582039 49 -1.28582039 50 -0.57582039 51 5.82417961 52 3.27417961 53 12.47417961 54 20.10417961 55 20.08863188 56 13.96349489 57 15.05349489 58 9.69669826 59 0.16935428 60 0.54788983 61 -0.53945637 62 -0.26365475 63 -2.51168817 64 -1.54470307 65 -1.56956778 66 -0.45811333 67 1.43188667 68 -0.96811333 69 -0.45811333 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1zlio1256751339.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/2x1rc1256751339.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/31wti1256751339.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/40tet1256751339.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/59dnc1256751339.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/6kazj1256751339.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/7rtrc1256751339.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/87tv41256751339.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. 1.000 4.000 5.336 8.268 14.060 18.060 > > #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/99l5u1256751339.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/10l45y1256751339.tab") > > system("convert tmp/1zlio1256751339.ps tmp/1zlio1256751339.png") > system("convert tmp/2x1rc1256751339.ps tmp/2x1rc1256751339.png") > system("convert tmp/31wti1256751339.ps tmp/31wti1256751339.png") > system("convert tmp/40tet1256751339.ps tmp/40tet1256751339.png") > system("convert tmp/59dnc1256751339.ps tmp/59dnc1256751339.png") > system("convert tmp/6kazj1256751339.ps tmp/6kazj1256751339.png") > system("convert tmp/7rtrc1256751339.ps tmp/7rtrc1256751339.png") > system("convert tmp/87tv41256751339.ps tmp/87tv41256751339.png") > > > proc.time() user system elapsed 2.636 1.989 2.950