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(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) > x <- c(-70.2974952,-56.0394412,-90.664494,-91.2847966,-85.5743388,-92.4729406,-82.0471026,-74.8694738,-88.7344614,-86.7421802,-65.6694738,-112.96662,-68.0513546,-56.331052,-93.9491138,-77.968746,-92.8847966,-88.3771352,-78.1596864,-69.747773,-94.8903894,-72.0016324,-75.1092938,-109.7847966,-61.1219924,-55.9478304,-75.7442488,-82.3861948,-85.9855244,-73.8736684,-74.5736684,-60.1610846,-81.175737,-66.4163422,-61.45689,-96.4995064,-61.4779204,-60.3771926,-65.1799316,-88.678476,-87.8841262,-64.0023602,-67.9862522,-70.7834558,-64.398836,-82.6372578,-64.3792612,-86.205827,-74.9023602,-47.5597438,-74.110692,-87.7743388,-74.8254592,-75.8946988,-67.0024176,-63.896097,-82.2247314,-78.3394412,-66.5268574,-96.8680756) > 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 -10.70950763 2 0.27933315 3 11.80570385 4 5.68027347 5 0.85260677 6 -3.09380862 7 -6.40868268 8 -0.78577530 9 3.45139771 10 -2.13046203 11 4.34195335 12 -7.72252347 13 -12.80373524 14 -0.49158877 15 8.85960201 16 4.68608094 17 4.78849457 18 -0.50676851 19 -3.32940155 20 7.74716433 21 4.07624654 22 3.14480857 23 9.22037819 24 -4.63092002 25 -11.07093558 26 0.93878271 27 11.40143352 28 10.74141248 29 1.43461322 30 0.07344320 31 -0.31671007 32 6.80372993 33 3.40561763 34 0.07254583 35 5.77730288 36 -3.41149682 37 -7.21338826 38 0.59938758 39 12.62526328 40 13.92661644 41 0.27500688 42 0.40402521 43 4.26744795 44 2.50559709 45 7.17952054 46 7.05254255 47 5.77085598 48 -4.46787244 49 -5.67121852 50 -0.77410476 51 9.87835890 52 -0.37358922 53 -11.20525784 54 -14.03197156 55 -15.76803482 56 -7.24301095 57 -8.13005739 58 -12.14983521 59 -6.47853592 60 -13.14835402 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1enf91256743293.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/2bfmc1256743293.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/3pde11256743293.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/400sc1256743293.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/59ngb1256743293.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/6mvxp1256743293.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/7tj8f1256743293.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/8obcd1256743293.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. -113.00 -87.00 -75.01 -76.73 -66.23 -47.56 > > #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/96p6u1256743293.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/10hlca1256743293.tab") > > system("convert tmp/1enf91256743293.ps tmp/1enf91256743293.png") > system("convert tmp/2bfmc1256743293.ps tmp/2bfmc1256743293.png") > system("convert tmp/3pde11256743293.ps tmp/3pde11256743293.png") > system("convert tmp/400sc1256743293.ps tmp/400sc1256743293.png") > system("convert tmp/59ngb1256743293.ps tmp/59ngb1256743293.png") > system("convert tmp/6mvxp1256743293.ps tmp/6mvxp1256743293.png") > system("convert tmp/7tj8f1256743293.ps tmp/7tj8f1256743293.png") > system("convert tmp/8obcd1256743293.ps tmp/8obcd1256743293.png") > > > proc.time() user system elapsed 1.800 1.560 3.259