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(89,97,154,81,110,116,73,73,174,103,130,91,136,106,136,122,131,135,75,68,143,115,93,128,152,125,107,116,220,137,34,51,153,145,116,145,98,118,139,140,113,149,79,47,166,180,122,134,114,125,181,142,143,187,137,62,239,157,139,187) > x <- c(356,386,444,387,327,448,225,182,460,411,342,361,377,331,428,340,352,461,221,198,422,329,320,375,364,351,380,319,322,386,221,187,344,342,365,313,356,337,389,326,343,357,220,228,391,425,332,298,360,326,325,393,301,426,265,210,429,440,357,431) > par2 = '1' > 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 -39.9622246 2 -42.8145982 3 -6.7958537 4 -59.1763439 5 -8.4715968 6 -46.2428369 7 -8.5735266 8 6.9815422 9 7.4162137 10 -45.8582428 11 6.1022164 12 -39.7709535 13 -0.5588861 14 -13.9185799 15 -19.0079212 16 -1.1742920 17 3.4847586 18 -31.9455321 19 -5.1265435 20 -3.8063904 21 -9.8374465 22 -4.1950883 23 -22.9393763 24 -7.8353945 25 20.1438091 26 -2.1534956 27 -30.6441234 28 0.4223695 29 103.3371322 30 -2.8145982 31 -46.1265435 32 -16.8271867 33 28.3787249 34 21.1022164 35 -16.2179366 36 31.5928442 37 -30.9622246 38 -4.0890546 39 -1.8998355 40 21.8901490 41 -11.2595294 42 19.6760296 43 -0.7647977 44 -35.6587640 45 24.3766729 46 26.0773162 47 1.7196743 48 26.0190310 49 -16.4092077 50 6.8901490 51 63.2518948 52 -0.3468187 53 33.9337937 54 32.7155704 55 40.9566420 56 -14.1473398 57 83.6303330 58 -2.3488706 59 9.6760296 60 30.9068415 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/142f71257272479.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/26um41257272479.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/3qf221257272479.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/474or1257272479.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/5ok3z1257272479.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/69hmc1257272479.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/7ao7u1257272479.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/8mafg1257272479.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. 182.0 321.5 351.5 344.0 387.5 461.0 > > #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/9y9ua1257272479.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/10cq9q1257272480.tab") > > system("convert tmp/142f71257272479.ps tmp/142f71257272479.png") > system("convert tmp/26um41257272479.ps tmp/26um41257272479.png") > system("convert tmp/3qf221257272479.ps tmp/3qf221257272479.png") > system("convert tmp/474or1257272479.ps tmp/474or1257272479.png") > system("convert tmp/5ok3z1257272479.ps tmp/5ok3z1257272479.png") > system("convert tmp/69hmc1257272479.ps tmp/69hmc1257272479.png") > system("convert tmp/7ao7u1257272479.ps tmp/7ao7u1257272479.png") > system("convert tmp/8mafg1257272479.ps tmp/8mafg1257272479.png") > > > proc.time() user system elapsed 2.690 2.002 3.091