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(0.002022723,-0.017208098,-0.051656261,-0.072675401,-0.04888664,-0.035594314,-0.043990322,-0.026968066,-0.008756337,0.032209121,0.042033292,0.026096897,0.026430772,0.042472121,0.058426687,0.053742338,0.041398106,0.052385238,0.052190308,0.039393774,0.00733234,0.018657154,0.017944976,0.006882464,0.009761905,0.019803549,0.004696588,-0.014269327,0.004359046,5.42631E-05,-0.004455318,-0.02117114,-0.021005357,-0.011061589,-0.028604411,-0.02249124,-0.030906084,-0.036827378,-0.055456866,-0.045366315,-0.043827384,-0.036552019,-0.067865593,-0.066311103,-0.051684645,-0.045133838,-0.061448816,-0.025835909,0.00011375,0.047607207,0.079794997,0.039112385,0.055018633,0.074915741,0.061521734,0.052521997,0.024700439,0.004811919,0.0048453,-0.007247995) > x <- c(-43.46299021,-80.75309516,-70.74336158,38.9668564,103.8074054,-154.6120618,80.77812389,-8.071755014,98.25849525,-30.58100421,-44.78092348,40.3791734,-132.19098,-76.88100421,-106.2410204,-60.55099614,-2.200632843,-67.52066514,-28.0902534,-21.31993855,204.9200453,-150.9996641,90.49044089,3.190198694,-95.23997084,-53.65976094,-80.03964792,206.0103925,95.62085262,70.15086069,-4.308751793,-9.298856744,138.9711352,77.72149848,281.4313935,108.1314743,118.3119264,-143.9872663,73.21297587,215.4333311,67.37396079,-107.8253934,-100.1751915,-279.1043923,25.05610826,71.32658458,126.5560275,225.3961728,229.2960114,-32.31452952,256.6652767,74.69536553,8.935672307,161.5151556,-242.1946587,-173.2347233,-53.46489282,-290.1749493,-360.6546748,-187.924909) > 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 0.0004578345 2 -0.0201156198 3 -0.0542033815 4 -0.0712723961 5 -0.0451490458 6 -0.0411611339 7 -0.0410818990 8 -0.0272586902 9 -0.0052185318 10 0.0311080495 11 0.0404209512 12 0.0275507525 13 0.0216712250 14 0.0397040142 15 0.0546014704 16 0.0515621945 17 0.0413188721 18 0.0499541509 19 0.0511789162 20 0.0386261479 21 0.0147105031 22 0.0132203988 23 0.0212030918 24 0.0069973274 25 0.0063327821 26 0.0178715249 27 0.0018147539 28 -0.0068519059 29 0.0078018827 30 0.0025800506 31 -0.0046104549 32 -0.0215059461 33 -0.0160016899 34 -0.0082632200 35 -0.0184714506 36 -0.0185979574 37 -0.0266462534 38 -0.0420116513 39 -0.0528208268 40 -0.0376096202 41 -0.0414015790 42 -0.0404342811 43 -0.0714724089 44 -0.0763602795 45 -0.0507824977 46 -0.0425657184 47 -0.0568921558 48 -0.0177205013 49 0.0083695717 50 0.0464437197 51 0.0890362514 52 0.0418017978 53 0.0553403626 54 0.0807311074 55 0.0528014955 56 0.0462846666 57 0.0227754312 58 -0.0056358538 59 -0.0081401011 60 -0.0140142467 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ksoz1257108581.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/28j6z1257108581.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/3v21y1257108581.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/4vacv1257108581.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/5sj781257108581.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/657yf1257108581.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/7k3hy1257108581.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/8uvu31257108581.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. -3.607e+02 -8.022e+01 -6.190e+00 -1.050e-09 9.177e+01 2.814e+02 > > #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/9ai9w1257108581.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/109yav1257108581.tab") > > system("convert tmp/1ksoz1257108581.ps tmp/1ksoz1257108581.png") > system("convert tmp/28j6z1257108581.ps tmp/28j6z1257108581.png") > system("convert tmp/3v21y1257108581.ps tmp/3v21y1257108581.png") > system("convert tmp/4vacv1257108581.ps tmp/4vacv1257108581.png") > system("convert tmp/5sj781257108581.ps tmp/5sj781257108581.png") > system("convert tmp/657yf1257108581.ps tmp/657yf1257108581.png") > system("convert tmp/7k3hy1257108581.ps tmp/7k3hy1257108581.png") > system("convert tmp/8uvu31257108581.ps tmp/8uvu31257108581.png") > > > proc.time() user system elapsed 1.596 1.153 2.611