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(1865409.391,2548895.896,1408694.561,860085.351,893056.347,1180932.193,1552836.312,1180932.193,1180932.193,1371330.631,559476.224,216000,1235376.017,979146.657,1462135.375,1291467.969,1006012.008,1121622.319,2668267.603,1736654.408,1006012.008,2936493.568,356400.829,618470.208,2352637,2548895.896,1638858.339,1201157.047,1829276.567,1976656.375,3268147.904,2014698.447,988047.936,2767587.264,517781.627,794022.776,2656741.625,1363938.029,1710777.536,1157625,1295029,2166720.184,3281379.256,1042590.744,2449456.192,2967360.453,543338.496,736314.327,2833148.375,2785366.143,2755776.808,1006012.008,1986121.593,1710777.536,2444008.923,1295029,1573037.747,3170044.709,924010.424,714516.984,2305199.161,2732256.792,2146689,1423828.125,1811386.459,1802485.313,1865409.391,2279122.496,1697936.057,2326203.125,949862.087,616295.051,2284322.013,2161700.757,746142.643,485587.656,327082.769,494913.671) > x <- c(474.552,512,531.441,551.368,571.787,551.368,512,493.039,438.976,438.976,571.787,592.704,592.704,592.704,592.704,636.056,704.969,681.472,571.787,421.875,373.248,405.224,681.472,804.357,804.357,658.503,551.368,571.787,614.125,636.056,614.125,551.368,531.441,493.039,636.056,658.503,658.503,614.125,592.704,614.125,658.503,658.503,636.056,614.125,571.787,512,551.368,531.441,531.441,512,493.039,493.039,512,512,493.039,512,456.533,373.248,421.875,389.017,343,343,343,373.248,389.017,357.911,314.432,262.144,226.981,274.625,456.533,493.039,421.875,328.509,287.496,328.509,456.533,512) > 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 213834.05 2 930247.45 3 -192860.01 4 -723948.01 5 -673023.21 6 -403101.17 7 -65812.14 8 -454388.09 9 -501924.04 10 -311525.60 11 -1006603.33 12 -1331687.87 13 -312311.86 14 -568541.22 15 -85552.50 16 -218101.81 17 -442964.66 18 -348014.55 19 1102188.05 20 38761.78 21 -734636.86 22 1223960.23 23 -1113236.04 24 -743117.61 25 991049.18 26 1059063.09 27 54824.98 28 -364922.51 29 300423.53 30 467086.60 31 1739294.87 32 430665.09 33 -613506.63 34 1132266.98 35 -991788.15 36 -695810.03 37 1166908.82 38 -164915.01 39 163089.66 40 -371228.04 41 -194803.81 42 676887.37 43 1771809.48 44 -486262.29 45 883376.64 46 1348712.00 47 -1040694.87 48 -865240.24 49 1231593.81 50 1166717.69 51 1120456.53 52 -629308.27 53 367473.14 54 92129.09 55 808688.64 56 -323619.45 57 -94381.15 58 1429395.84 59 -773882.20 60 -1012266.68 61 537954.15 62 965011.78 63 379443.98 64 -316820.74 65 84602.79 66 48351.09 67 73045.40 68 440783.25 69 -171320.94 70 498838.05 71 -717556.81 72 -1019025.23 73 586429.39 74 381714.24 75 -1069905.35 76 -1294398.86 77 -1340336.13 78 -1123734.78 > library(lattice) > postscript(file="/var/www/rcomp/tmp/17ram1256758797.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/2r13i1256758797.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/3w5331256758797.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/4o31u1256758797.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/5i3ay1256758797.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/6ekdn1256758797.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/7680v1256758797.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/8aca51256758797.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. 227.0 426.2 512.0 513.4 592.7 804.4 > > #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/97dho1256758797.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/10yjgb1256758797.tab") > > system("convert tmp/17ram1256758797.ps tmp/17ram1256758797.png") > system("convert tmp/2r13i1256758797.ps tmp/2r13i1256758797.png") > system("convert tmp/3w5331256758797.ps tmp/3w5331256758797.png") > system("convert tmp/4o31u1256758797.ps tmp/4o31u1256758797.png") > system("convert tmp/5i3ay1256758797.ps tmp/5i3ay1256758797.png") > system("convert tmp/6ekdn1256758797.ps tmp/6ekdn1256758797.png") > system("convert tmp/7680v1256758797.ps tmp/7680v1256758797.png") > system("convert tmp/8aca51256758797.ps tmp/8aca51256758797.png") > > > proc.time() user system elapsed 1.730 1.640 3.299