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(241.66,251.25,230.26,240.91,211.20,188.19,177.01,167.85,174.03,170.09,203.42,254.97,342.84,386.29,440.51,433.58,408.13,370.32,355.51,332.62,314.62,301.73,306.31,282.98,266.48,249.97,259.87,246.24,238.36,238.04,224.19,214.71,203.11,221.00,211.73,209.39,217.48,242.19,244.64,232.07,235.80,230.37,209.82,206.41,209.60,192.24,186.17,193.41,202.36,203.00,190.64,185.43,171.58,179.57,180.42,162.10,157.95,146.66,154.43,163.38,150.92,151.98,144.74,140.37,143.36,135.79,134.73,126.42,124.72,117.90,114.07,112.26,105.44,110.77,107.68,105.76,102.03,100.22,111.62,118.11,111.72,103.42,97.13,103.10,104.91,100.22,98.52,95.32,96.92,96.60,92.55,82.75,80.84,79.13,79.77,85.10,96.39,97.56,96.39,101.18,103.52,100.11,99.26,104.48,101.29,100.33,115.24,113.64,115.35,108.42,105.65,108.64,104.80,95.43,104.48,103.84,100.01) > x <- c(124.06,124.58,122.00,124.02,124.16,124.29,123.93,124.62,121.81,124.14,124.31,125.15,125.35,125.48,124.17,125.33,124.46,123.39,123.14,122.24,119.31,120.87,120.43,119.41,118.85,119.08,117.25,118.51,118.42,118.56,117.97,117.98,115.25,117.23,117.08,116.83,117.17,117.73,115.74,116.99,116.90,116.49,115.84,115.92,113.32,114.84,114.75,114.84,115.03,115.03,112.99,114.15,113.77,113.57,113.38,112.71,110.27,111.73,112.12,112.31,111.73,111.83,109.99,111.15,111.25,110.87,110.27,110.18,108.15,109.60,109.60,109.41,109.80,109.60,107.76,109.02,108.62,109.02,109.22,108.92,106.69,107.76,107.66,107.85,107.95,107.85,106.30,107.37,107.66,107.46,107.37,107.18,105.43,106.39,106.50,106.50,106.69,106.50,105.14,106.50,106.20,105.72,104.76,104.55,102.71,104.36,104.65,104.46,104.65,103.88,102.32,103.39,103.00,102.71,102.51,102.04,100.00) > 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 -45.71803615 2 -41.42506720 3 -36.13364390 4 -46.06057222 5 -77.19669596 6 -101.53095373 7 -109.04377838 8 -125.23253113 9 -90.42819024 10 -118.10296400 11 -86.50468569 12 -43.51142816 13 42.32125220 14 84.44699444 15 152.01143805 16 133.26498417 17 116.67732458 18 89.76698463 19 77.50363418 20 63.78157254 21 75.62830520 22 46.84721204 23 55.90931524 24 42.96964538 25 32.17414036 26 13.32122278 27 41.86269745 28 15.39758374 29 8.43437758 30 6.68825383 31 -1.15165324 32 -10.73351922 33 5.47589381 34 3.19642941 35 -4.54558086 36 -4.33893132 37 0.28762530 38 19.29313032 39 42.01446070 40 16.71121297 41 21.35800681 42 20.10451206 43 6.17580088 44 1.95087303 45 31.62602829 46 -1.21760094 47 -6.37080711 48 -0.04760094 49 6.96694540 50 7.60694540 51 16.02760569 52 -0.99884820 53 -10.97794089 54 -0.95062126 55 1.83483240 56 -9.66014682 57 11.04515273 58 -15.11728061 59 -11.32005390 60 -4.30550755 61 -10.85728061 62 -10.81594042 63 0.68740022 64 -15.49905366 65 -13.52771348 66 -17.22680617 67 -12.17484727 68 -19.56805343 69 -0.58925913 70 -22.17982649 71 -26.00982649 72 -25.88437283 73 -36.67714612 74 -29.30982649 75 -13.65648584 76 -28.41159954 77 -28.06696027 78 -33.95159954 79 -24.58891918 80 -15.04293973 81 1.28317421 82 -17.91648584 83 -23.18782602 84 -19.15327968 85 -18.36193949 86 -22.03327968 87 -7.94405250 88 -22.04371255 89 -23.39782602 90 -21.68050639 91 -24.81371255 92 -32.67825890 93 -16.76171208 94 -28.25084633 95 -28.73137213 96 -23.40137213 97 -14.04682579 98 -10.94137213 99 1.74240139 100 -7.32137213 101 -1.92539268 102 -0.44582556 103 8.48330870 104 15.84249431 105 31.39583496 106 13.62794797 107 25.58383450 108 25.91928815 109 25.69383450 110 26.60751509 111 39.72860825 112 31.81894820 113 31.95172149 114 25.53583496 115 36.62315460 116 40.77085574 117 57.72151602 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1sstp1257764215.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/2sd321257764215.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/35qjp1257764215.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/4gp4h1257764215.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/55cot1257764215.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/6bpx31257764215.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/7fhyd1257764215.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/8hb751257764215.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. 100.0 107.4 111.8 113.0 118.0 125.5 > > #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/9ht9l1257764215.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/109zjm1257764215.tab") > > system("convert tmp/1sstp1257764215.ps tmp/1sstp1257764215.png") > system("convert tmp/2sd321257764215.ps tmp/2sd321257764215.png") > system("convert tmp/35qjp1257764215.ps tmp/35qjp1257764215.png") > system("convert tmp/4gp4h1257764215.ps tmp/4gp4h1257764215.png") > system("convert tmp/55cot1257764215.ps tmp/55cot1257764215.png") > system("convert tmp/6bpx31257764215.ps tmp/6bpx31257764215.png") > system("convert tmp/7fhyd1257764215.ps tmp/7fhyd1257764215.png") > system("convert tmp/8hb751257764215.ps tmp/8hb751257764215.png") > > > proc.time() user system elapsed 1.614 1.178 2.569