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(123.560,122.117,121.782,121.789,122.273,121.683,119.869,118.873,117.607,122.783,124.454,127.064,125.166,124.554,124.272,128.836,127.408,126.420,124.465,124.526,124.379,130.189,132.196,134.893,132.709,129.955,127.947,130.369,129.852,124.278,126.141,121.743,110.898,117.707,120.738,121.445,120.439,116.313,117.173,119.773,119.639,113.006,113.776,107.866,106.924,114.562,115.367,116.602,114.393,115.140,117.623,119.361,120.527,121.660,122.852,119.325,119.151,126.494,127.832,128.780) > x <- c(111.632,106.707,108.827,108.413,106.249,104.861,102.382,100.320,100.228,117.089,121.523,114.948,112.831,107.605,108.928,101.993,102.850,99.925,101.536,99.450,98.305,110.159,109.483,106.810,96.279,91.982,90.276,90.999,86.622,83.117,80.367,77.550,77.443,92.844,92.175,84.822,81.632,78.872,81.485,80.651,78.192,76.844,76.335,71.415,73.889,86.822,86.371,83.469,82.662,82.880,89.406,95.378,97.657,100.247,99.180,97.493,101.628,114.585,115.669,111.311) > 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 -2.77235612 2 -2.86001211 3 -3.77842923 4 -3.65749777 5 -2.57797199 6 -2.78599890 7 -3.91778614 8 -4.34633043 9 -5.58701233 10 -5.05110482 11 -4.60032723 12 -0.18090856 13 -1.49631703 14 -0.67013879 15 -1.31622410 16 5.15626540 17 3.49242178 18 3.30937228 19 0.91103031 20 1.54609074 21 1.71419103 22 4.26200870 23 6.45504170 24 9.88764263 25 10.60173965 26 9.03026011 27 7.49174577 28 9.71477852 29 10.40231471 30 5.79287934 31 8.41267042 32 4.78989967 33 -6.02565427 34 -3.45495949 35 -0.23985287 36 2.49066887 37 2.36254652 38 -1.00391044 39 -0.86299956 40 1.96651454 41 2.50922336 42 -3.75281142 43 -2.84273627 44 -7.39876823 45 -9.02160501 46 -4.94272464 47 -4.01361090 48 -1.97998992 49 -3.96690614 50 -3.27989903 51 -2.59283305 52 -2.49830807 53 -1.95948148 54 -1.53924107 55 -0.05360613 56 -3.11634921 57 -4.42828779 58 -0.65101214 59 0.38867458 60 2.53598203 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1mm311256674338.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/2rcq31256674338.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/3t1en1256674338.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/4vum11256674338.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/5mz7q1256674338.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/6x4v91256674338.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/7g5gh1256674338.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/8ztgw1256674338.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. 71.42 83.38 97.98 95.86 106.70 121.50 > > #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/9ymoi1256674338.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/10rt2g1256674339.tab") > > system("convert tmp/1mm311256674338.ps tmp/1mm311256674338.png") > system("convert tmp/2rcq31256674338.ps tmp/2rcq31256674338.png") > system("convert tmp/3t1en1256674338.ps tmp/3t1en1256674338.png") > system("convert tmp/4vum11256674338.ps tmp/4vum11256674338.png") > system("convert tmp/5mz7q1256674338.ps tmp/5mz7q1256674338.png") > system("convert tmp/6x4v91256674338.ps tmp/6x4v91256674338.png") > system("convert tmp/7g5gh1256674338.ps tmp/7g5gh1256674338.png") > system("convert tmp/8ztgw1256674338.ps tmp/8ztgw1256674338.png") > > > proc.time() user system elapsed 1.660 1.480 3.155