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(508.8044811 + ,505.0346523 + ,497.6926763 + ,494.7514528 + ,490.8166664 + ,489.8295622 + ,519.8528638 + ,532.8161034 + ,531.3642818 + ,523.0391955 + ,504.7335931 + ,504.335206 + ,505.8092526 + ,504.4700189 + ,501.9910358 + ,496.325498 + ,493.9827932 + ,495.9364879 + ,528.9669177 + ,532.0817606 + ,530.1858165 + ,525.3227579 + ,520.2826155 + ,521.4412719 + ,523.8434881 + ,521.9511471 + ,518.0357131 + ,518.252834 + ,514.5561194 + ,519.5902232 + ,552.0362307 + ,556.2058971 + ,555.2900143 + ,546.2847243 + ,537.8020082 + ,540.3471107 + ,543.058008 + ,541.7453276 + ,539.031539 + ,533.6065967 + ,530.8653313 + ,536.5202699 + ,562.3726523 + ,570.448946 + ,570.9737297 + ,572.9589863 + ,563.4536361 + ,563.5059893 + ,560.1223081 + ,558.8166068 + ,556.2292693 + ,550.4089389 + ,548.0109488 + ,551.3936888 + ,577.4738089 + ,581.1178882 + ,579.5964113 + ,569.1493653 + ,560.2918882 + ,560.7896219 + ,559.6588246 + ,556.4746176 + ,550.4207482 + ,546.7988661 + ,546.2810632 + ,549.2094318 + ,574.251687 + ,578.8635418 + ,572.3774978 + ,555.984712 + ,543.9816173 + ,539.8268241 + ,539.9462936 + ,533.5522467 + ,525.8089006 + ,522.0785382 + ,514.7630523 + ,513.1179202 + ,544.7990455 + ,550.9972777 + ,535.7182095 + ,525.7632547 + ,516.162765 + ,516.8684552 + ,518.0550164 + ,512.3690076 + ,505.511622 + ,503.1480895 + ,493.7641137 + ,500.7404517 + ,529.5705808 + ,534.0945609 + ,520.5535515 + ,510.9559668 + ,505.5719533 + ,510.2705165 + ,513.7149015 + ,514.0924041 + ,513.1042779 + ,512.4177983 + ,506.1294301 + ,514.0243185 + ,542.0885537) > x <- c(456.2400684 + ,452.7802999 + ,447.5377079 + ,445.0707809 + ,441.7985966 + ,437.4871427 + ,462.3505164 + ,475.1631299 + ,480.1864221 + ,478.8120717 + ,465.0032258 + ,465.5244354 + ,469.2611213 + ,469.1641504 + ,467.3799311 + ,463.5860222 + ,459.026143 + ,457.9006442 + ,486.8685654 + ,492.0172761 + ,491.8109393 + ,492.5657317 + ,488.4106878 + ,490.2417771 + ,494.7241656 + ,494.5462567 + ,491.4997457 + ,490.4497936 + ,485.8899052 + ,486.8233766 + ,514.3724332 + ,519.9509592 + ,519.273531 + ,516.7562288 + ,508.0482261 + ,512.652904 + ,517.1199087 + ,517.0744627 + ,514.5648647 + ,508.7858096 + ,504.8207603 + ,504.8445305 + ,526.5614874 + ,534.1825531 + ,535.3522205 + ,532.016917 + ,526.0104562 + ,527.1764411 + ,526.4294825 + ,526.4057371 + ,524.439701 + ,519.7595598 + ,516.8558793 + ,514.774708 + ,535.965484 + ,539.6165305 + ,540.6477596 + ,536.8295819 + ,530.5440604 + ,531.6540228 + ,529.3297649 + ,529.5356456 + ,526.1520693 + ,524.6103316 + ,523.7862159 + ,520.875225 + ,538.3326109 + ,539.1901334 + ,540.6477596 + ,527.7366768 + ,519.4477837 + ,515.617106 + ,518.6848754 + ,513.9805444 + ,505.1712581 + ,503.3418322 + ,496.0413289 + ,485.1515227 + ,508.4840214 + ,510.87474 + ,504.6414569 + ,500.6425871 + ,493.3781511 + ,497.0965701 + ,498.5388651 + ,495.0141412 + ,486.9086157 + ,486.9137501 + ,474.9252573 + ,476.2761804 + ,497.9297139 + ,498.3302118 + ,496.9597569 + ,495.0737319 + ,496.2489295 + ,505.7321425 + ,514.1196359 + ,518.0222003 + ,522.5380369 + ,523.4147495 + ,517.1363457 + ,521.5294814 + ,541.0268016) > 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 13.9735370 2 12.9744603 3 9.8310088 4 8.8654213 5 7.5511603 6 10.0168796 7 20.1283736 8 22.8306447 9 17.3559246 10 10.1314854 11 2.8846833 12 2.0688860 13 0.5504115 14 -0.7111632 15 -1.7612561 16 -4.3884458 17 -3.0793759 18 -0.2243267 19 9.6071728 20 8.5986760 21 6.8679765 22 1.4004432 23 -0.3121366 24 -0.6199062 25 -1.8074063 26 -3.5572691 27 -5.0329078 28 -3.9749339 29 -4.0198665 30 0.2666677 31 10.6500412 32 10.3521507 33 9.9787855 34 2.9894745 35 1.4805535 36 0.3380044 37 -0.5284945 38 -1.8047795 39 -2.5087591 40 -3.3055510 41 -2.8714107 42 2.7644916 43 11.2248711 44 13.1978420 45 12.7858988 46 17.4422298 47 12.7471476 48 11.8657230 49 9.0802428 50 7.7935580 51 6.7807185 52 4.7084745 53 4.6358940 54 9.6853379 55 18.7948465 56 19.5149889 57 17.1676532 58 9.7783910 59 5.9546674 60 5.5634888 61 6.2940711 62 2.9449848 63 -0.3991510 64 -2.7863340 65 -2.6441447 66 2.6154880 67 13.6770134 68 17.6021222 69 9.9487397 70 3.8957815 71 -1.4691616 72 -2.5561604 73 -4.8935109 74 -7.5200991 75 -8.2085372 76 -10.4738057 77 -11.9426909 78 -4.8667328 79 8.1285846 80 12.4122122 81 2.1250625 82 -4.6274015 83 -8.4101750 84 -10.6823769 85 -10.6508762 86 -13.5141134 87 -13.8801971 88 -16.2478415 89 -16.0308450 90 -10.1363924 91 1.3525263 92 5.5557681 93 -6.8877139 94 -14.9748774 95 -21.3000467 96 -24.1961050 97 -27.4688356 98 -30.2166977 99 -34.8213271 100 -36.2099211 101 -37.4702360 102 -33.0935858 103 -20.6437598 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1glz61256731137.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/2hl6s1256731137.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/3up1y1256731137.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/4kmib1256731137.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/51un11256731137.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/6f0fc1256731137.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/7aw9m1256731137.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/8olnl1256731137.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. 437.5 487.7 505.7 502.9 523.0 541.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/9bhnn1256731137.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/10y8y91256731137.tab") > > system("convert tmp/1glz61256731137.ps tmp/1glz61256731137.png") > system("convert tmp/2hl6s1256731137.ps tmp/2hl6s1256731137.png") > system("convert tmp/3up1y1256731137.ps tmp/3up1y1256731137.png") > system("convert tmp/4kmib1256731137.ps tmp/4kmib1256731137.png") > system("convert tmp/51un11256731137.ps tmp/51un11256731137.png") > system("convert tmp/6f0fc1256731137.ps tmp/6f0fc1256731137.png") > system("convert tmp/7aw9m1256731137.ps tmp/7aw9m1256731137.png") > system("convert tmp/8olnl1256731137.ps tmp/8olnl1256731137.png") > > > proc.time() user system elapsed 2.572 1.907 2.854