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(1076.7,1035.9,1037,1154,1237.2,996.6,1238.2,1153.4,1268.1,1156,1144.5,1232.9,1055.2,1109.7,1079.8,1126.3,1196.8,1130.4,1183.6,1200.9,1426.6,1080.4,1325.4,1230,1125.9,1174.5,1151.9,1439.3,1344.3,1319.1,1257.6,1249.1,1397.1,1348,1548.2,1377.6,1402.9,1167.6,1392.9,1547,1420,1266.4,1280.8,1128.6,1449.5,1511.7,1548.3,1652,1650.5,1370.8,1653.3,1474.3,1418.8,1554.1,1156.6,1223.4,1337.5,1098.9,1037.6,1202.5) > x <- c(0.818465,0.800641,0.769764,0.745823,0.762253,0.768403,0.757518,0.772917,0.787774,0.82203,0.830772,0.813537,0.815927,0.832293,0.848464,0.843455,0.826241,0.837661,0.831947,0.81493,0.783085,0.790514,0.788395,0.780579,0.785731,0.792959,0.776337,0.75683,0.76929,0.764877,0.755173,0.739864,0.740138,0.745212,0.729076,0.734107,0.719632,0.702889,0.681013,0.686342,0.67944,0.678058,0.644039,0.63488,0.642797,0.642963,0.634115,0.66778,0.695894,0.750638,0.785423,0.74355,0.755344,0.782167,0.766284,0.75815,0.732601,0.71347,0.709824,0.700869) > 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 -104.322853 2 -171.364224 3 -215.722866 4 -133.969987 5 -26.580931 6 -258.126597 7 -32.552031 8 -94.680864 9 41.892344 10 -19.774284 11 -18.403881 12 44.621903 13 -129.559422 14 -50.964589 15 -57.056846 16 -17.931343 17 27.225358 18 -22.361555 19 22.426012 20 14.672746 21 193.488967 22 -141.773693 23 100.106611 24 -6.800490 25 -103.315462 26 -44.074044 27 -91.145772 28 167.535061 29 90.879288 30 59.182251 31 -16.604456 32 -47.643120 33 100.760276 34 59.130469 35 235.574254 36 72.381140 37 76.370332 38 -183.579538 39 9.513536 40 171.459152 41 34.297688 42 -121.336961 43 -157.021410 44 -322.705741 45 9.850056 46 72.294450 47 95.867988 48 249.131261 49 289.022078 50 89.918894 51 423.631086 52 182.983591 53 144.847299 54 319.637442 55 -101.246294 56 -46.421570 57 30.063933 58 -236.701669 59 -303.369489 60 -151.653482 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1t8wv1256591768.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/2icsl1256591768.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/38xdr1256591768.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/4a4v91256591768.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/5tfod1256591768.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/677zv1256591768.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/7z1u11256591768.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/895u01256591768.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. 0.6341 0.7181 0.7602 0.7540 0.7889 0.8485 > > #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/99lpl1256591768.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/100tx11256591768.tab") > > system("convert tmp/1t8wv1256591768.ps tmp/1t8wv1256591768.png") > system("convert tmp/2icsl1256591768.ps tmp/2icsl1256591768.png") > system("convert tmp/38xdr1256591768.ps tmp/38xdr1256591768.png") > system("convert tmp/4a4v91256591768.ps tmp/4a4v91256591768.png") > system("convert tmp/5tfod1256591768.ps tmp/5tfod1256591768.png") > system("convert tmp/677zv1256591768.ps tmp/677zv1256591768.png") > system("convert tmp/7z1u11256591768.ps tmp/7z1u11256591768.png") > system("convert tmp/895u01256591768.ps tmp/895u01256591768.png") > > > proc.time() user system elapsed 1.88 1.54 3.18