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(272.433,268.361,268.586,264.768,269.974,304.744,309.365,308.347,298.427,289.231,291.975,294.912,293.488,290.555,284.736,281.818,287.854,316.263,325.412,326.011,328.282,317.480,317.539,313.737,312.276,309.391,302.950,300.316,304.035,333.476,337.698,335.932,323.931,313.927,314.485,313.218,309.664,302.963,298.989,298.423,301.631,329.765,335.083,327.616,309.119,295.916,291.413,291.542,284.678,276.475,272.566,264.981,263.290,296.806,303.598,286.994,276.427,266.424,267.153,268.381,262.522,255.542,253.158,243.803,250.741,280.445,285.257,270.976,261.076,255.603,260.376,263.903,264.291,263.276,262.572,256.167,264.221,293.860,300.713) > x <- c(97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1) > 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 -21.8532328 2 -21.7509993 3 -22.8677172 4 -28.9716070 5 -20.5852386 6 5.6872146 7 11.5505460 8 20.4215040 9 11.4456758 10 -4.2601407 11 -2.3609261 12 -0.3184047 13 -0.7982328 14 4.0706084 15 -6.6183307 16 -12.2694598 17 0.7235961 18 17.2062146 19 31.0263807 20 40.2223140 21 40.6049703 22 26.6226019 23 25.5386570 24 18.2581290 25 17.4431414 26 18.9311479 27 11.5459761 28 6.5763930 29 18.1469275 30 31.1891530 31 42.7657549 32 49.6960747 33 34.0674670 34 25.5045714 35 22.8325098 36 19.9256323 37 17.2164177 38 17.8700196 39 6.5414177 40 10.5471972 41 16.0907803 42 29.7143495 43 42.5360312 44 42.1751668 45 24.5229521 46 9.5309949 47 -0.3885700 48 1.7281602 49 -5.4836925 50 -6.9781030 51 -17.1981465 52 -23.1929623 53 -20.9581951 54 0.2835707 55 12.8896816 56 0.4102219 57 -5.2371457 58 -19.7622321 59 -25.6424351 60 -19.0972567 61 -23.9126983 62 -32.3834960 63 -31.0405018 64 -44.4703488 65 -34.1532074 66 -14.3381654 67 -7.6378216 68 -13.4709681 69 -23.9175939 70 -37.4905947 71 -35.2519507 72 -33.3648282 73 -31.8835765 74 -27.9789442 75 -33.1553372 76 -40.7032821 77 -27.2327172 78 -7.5820617 79 2.5010000 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1q2u61258912391.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/25ngo1258912391.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/3jc2d1258912391.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/45jvy1258912391.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/5085w1258912391.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/6olav1258912391.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/7hhxg1258912391.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/8qxwc1258912391.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. 80.90 96.95 102.90 103.50 111.60 122.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/91f7a1258912391.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/101kx91258912391.tab") > > system("convert tmp/1q2u61258912391.ps tmp/1q2u61258912391.png") > system("convert tmp/25ngo1258912391.ps tmp/25ngo1258912391.png") > system("convert tmp/3jc2d1258912391.ps tmp/3jc2d1258912391.png") > system("convert tmp/45jvy1258912391.ps tmp/45jvy1258912391.png") > system("convert tmp/5085w1258912391.ps tmp/5085w1258912391.png") > system("convert tmp/6olav1258912391.ps tmp/6olav1258912391.png") > system("convert tmp/7hhxg1258912391.ps tmp/7hhxg1258912391.png") > system("convert tmp/8qxwc1258912391.ps tmp/8qxwc1258912391.png") > > > proc.time() user system elapsed 1.589 1.164 2.540