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(34.97,34.97,34.93,34.92,34.97,34.97,34.97,35.38,35.64,35.9,36.01,36.03,36.04,36.06,36.09,36.15,36.15,36.15,36.1,36.38,36.89,37,37.09,37.13,37.24,37.29,37.34,37.49,37.49,37.54,37.67,38.13,38.68,38.77,39,39.03,39.03,39.04,39.16,39.23,39.26,39.25,39.41,39.56,39.69,39.87,39.83,39.84,39.85,39.91,40.62,40.73,40.86,40.89,40.9,41.15,41.24,41.24,41.33,41.36) > x <- c(433,344,357,385,392,308,294,302,400,392,373,379,303,324,353,392,327,376,329,359,413,338,422,390,370,367,406,418,346,350,329,318,381,337,372,422,427,426,396,458,314,336,385,351,381,438,397,451,362,363,468,371,407,391,364,366,424,364,366,423) > 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 -4.051153034 2 -2.465684280 3 -2.737269603 4 -3.246068762 5 -3.320768552 6 -1.824371076 7 -1.574971496 8 -1.307485541 9 -2.793282597 10 -2.390768552 11 -1.942297694 12 -2.029183228 13 -0.665299797 14 -1.019399166 15 -1.506012581 16 -2.140768552 17 -0.982841933 18 -1.855740461 19 -1.068470445 20 -1.322898115 21 -1.774867921 22 -0.328798746 23 -1.735196222 24 -1.125140041 25 -0.658854927 26 -0.555412160 27 -1.200168131 28 -1.263939199 29 0.018687209 30 -0.002569814 31 0.501529555 32 1.157486368 33 0.585188260 34 1.459015510 35 1.065516562 36 0.204803778 37 0.115732500 38 0.143546755 39 0.797974425 40 -0.236509426 41 2.358743390 42 1.956829766 43 1.243931238 44 1.999615931 45 1.595188260 46 0.759775687 47 1.450160170 48 0.498190363 49 2.093659118 50 2.135844863 51 0.975348017 52 2.813330817 53 2.302017613 54 2.617045704 55 3.108030607 56 3.322402096 57 2.379175267 58 3.448030607 59 3.502402096 60 2.516989522 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1b3cq1257697538.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/2osog1257697538.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/32lkh1257697538.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/4mtcm1257697538.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/52hxl1257697538.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/6t60c1257697538.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/7ouho1257697538.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/8bh001257697538.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. 294.0 349.0 372.5 375.5 401.5 468.0 > > #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/9lhq41257697538.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/109mva1257697538.tab") > > system("convert tmp/1b3cq1257697538.ps tmp/1b3cq1257697538.png") > system("convert tmp/2osog1257697538.ps tmp/2osog1257697538.png") > system("convert tmp/32lkh1257697538.ps tmp/32lkh1257697538.png") > system("convert tmp/4mtcm1257697538.ps tmp/4mtcm1257697538.png") > system("convert tmp/52hxl1257697538.ps tmp/52hxl1257697538.png") > system("convert tmp/6t60c1257697538.ps tmp/6t60c1257697538.png") > system("convert tmp/7ouho1257697538.ps tmp/7ouho1257697538.png") > system("convert tmp/8bh001257697538.ps tmp/8bh001257697538.png") > > > proc.time() user system elapsed 1.970 1.830 3.489