R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(412.06293,416.05528,430.05719,438.05528,441.05145,451.06867,444.06102,450.05337,450.05528,452.06102,451.07058,445.06293,444.06102,445.06867,461.06867,461.07249,460.07441,454.05910,448.06102,454.07058,457.07058,456.07058,452.05910,449.06676,451.07058,450.06484,465.06293,465.06102,460.05337,442.04954,432.05528,431.05719,433.04954,427.05145,416.05145,413.05145,405.04189,395.04189,420.04189,423.03997,407.04380,401.05910,393.07249,398.07632,401.08397,395.08589,387.10119,386.09545,374.11458,379.12797,402.12988,402.12032,390.12223,386.10884,386.07823,398.06867,408.05719,413.05337,417.02850,419.03041) > x <- c(109.44073,111.43416,148.43580,157.43416,156.43087,144.44567,134.43909,130.43251,125.43416,122.43909,117.44731,112.44073,107.43909,108.44567,144.44567,152.44895,152.45060,142.43745,132.43909,127.44731,120.44731,118.44731,112.43745,109.44402,106.44731,107.44238,139.44073,145.43909,144.43251,129.42923,118.43416,111.43580,112.42923,106.43087,100.43087,97.43087,90.42265,88.42265,119.42265,125.42101,119.42429,110.43745,101.44895,100.45224,100.45882,96.46046,90.47361,88.46868,79.48512,82.49663,111.49827,115.49005,112.49170,104.48019,100.45389,102.44567,104.43580,104.43251,103.41114,102.41279) > 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 -7.6556996 2 -5.6847135 3 -29.2029459 4 -30.3293095 5 -26.3157904 6 -4.1454223 7 -1.0062706 8 9.0488035 9 14.1191051 10 19.1618849 11 23.2331745 12 22.3022615 13 26.3720793 14 26.3590441 15 5.8545777 16 -2.2570320 17 -3.2567851 18 0.8813688 19 5.0217553 20 16.0930449 21 26.1911356 22 27.2191616 23 29.3017575 24 29.3447943 25 34.3873170 26 32.3725632 27 14.9239117 28 8.8395869 29 4.8526221 30 2.0623124 31 3.2171958 32 9.3155335 33 10.3005327 34 10.3848574 35 5.4689352 36 5.5109740 37 4.6078399 38 -3.3641342 39 -9.7985358 40 -12.8828706 41 -22.7982888 42 -19.6702166 43 -18.5423712 44 -12.5278643 45 -9.5268865 46 -11.4705777 47 -13.3845342 48 -12.3572492 49 -15.2286729 50 -13.2689931 51 -19.6751218 52 -23.7323985 53 -32.6901227 54 -28.5797378 55 -24.5276274 56 -14.5568781 57 -6.5863758 58 -1.5868596 59 3.4239528 60 6.4382026 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1oa761257350276.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/rcomp/tmp/2rjl31257350276.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/rcomp/tmp/3xdrt1257350276.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/rcomp/tmp/429m31257350276.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/rcomp/tmp/5yrak1257350276.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/rcomp/tmp/64ptt1257350276.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/rcomp/tmp/70vkq1257350276.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/rcomp/tmp/86wc71257350276.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. 79.49 103.20 112.00 116.20 127.90 157.40 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/9joo21257350276.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/rcomp/tmp/10oyku1257350276.tab") > > system("convert tmp/1oa761257350276.ps tmp/1oa761257350276.png") > system("convert tmp/2rjl31257350276.ps tmp/2rjl31257350276.png") > system("convert tmp/3xdrt1257350276.ps tmp/3xdrt1257350276.png") > system("convert tmp/429m31257350276.ps tmp/429m31257350276.png") > system("convert tmp/5yrak1257350276.ps tmp/5yrak1257350276.png") > system("convert tmp/64ptt1257350276.ps tmp/64ptt1257350276.png") > system("convert tmp/70vkq1257350276.ps tmp/70vkq1257350276.png") > system("convert tmp/86wc71257350276.ps tmp/86wc71257350276.png") > > > proc.time() user system elapsed 1.632 1.172 2.476