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(4.012183183,4.106938451,4.108010484,4.141313872,4.185701802,4.048771866,4.134599399,4.089850968,4.186211251,4.103672176,4.086855545,4.13620441,4.049766084,4.144581392,4.048408136,4.07195101,4.048784424,4.216331476,4.045716502,4.218291042,4.001665006,4.067489319,4.047231333,3.936061117,3.972501114,3.989660544,4.080761732,4.112204927,4.040884065,4.066263013,4.026670229,4.009421149,3.956053116,4.012681854,4.068386696,4.028650315,3.971412582,4.053322538,4.040778316,4.002711031,3.909480253,3.947800218,3.921515845,3.930913782,4.029269377,3.934086181,3.939299911,3.909853912,3.845703063,3.896717236,3.876659139,3.8301881,3.824928136,3.895183885,3.828587723,3.897376051,3.803585788,3.841106362,3.921397953,3.959420373) > x <- c(3.99583882,4.137042328,4.138229803,4.161876877,4.181438196,4.057753019,4.140497568,4.105476121,4.209970517,4.121822377,4.093106357,4.169677105,4.034043733,4.169405375,4.073021454,4.076688221,4.025794834,4.202029854,4.045122414,4.209770649,4.004321374,4.084565108,4.06611536,3.966139262,3.95331395,4.010491882,4.095433075,4.124095387,4.035014258,4.072897547,4.038458858,4.028380089,3.968356845,4.018417971,4.088540477,4.037873401,3.970087387,4.06651447,4.04453976,3.993001403,3.872093116,3.922341324,3.927659796,3.914920585,4.018403531,3.93132563,3.931227149,3.902952309,3.799437999,3.88056018,3.857361682,3.789050405,3.78277776,3.86152898,3.818122918,3.886956404,3.806258265,3.847698702,3.918890159,3.982874001) > 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.0156000852 2 -0.0154182883 3 -0.0154039702 4 -0.0031636468 5 0.0238005070 6 -0.0029598211 7 0.0091649874 8 -0.0043889288 9 -0.0011045253 10 -0.0051277566 11 0.0036337191 12 -0.0152209750 13 0.0191528753 14 -0.0066019560 15 -0.0169235437 16 0.0033532454 17 0.0255187245 18 0.0360886550 19 0.0052352237 20 0.0311532933 21 -0.0024737235 22 -0.0081245940 23 -0.0119489090 24 -0.0340678111 25 0.0137960253 26 -0.0199744177 27 -0.0045325622 28 0.0013803652 29 0.0094063844 30 0.0010417004 31 -0.0078756465 32 -0.0161473045 33 -0.0160510710 34 -0.0040130815 35 -0.0107681816 36 -0.0053740787 37 -0.0022330438 38 -0.0062132017 39 0.0008160228 40 0.0086552944 41 0.0231206761 42 0.0166832538 43 -0.0143384207 44 0.0064066633 45 0.0125873035 46 -0.0050333385 47 0.0002681111 48 -0.0039927517 49 0.0240592908 50 0.0028158247 51 0.0034212340 52 0.0177968283 53 0.0181240725 54 0.0182340592 55 -0.0096991931 56 -0.0022226435 57 -0.0241329727 58 -0.0235244751 59 -0.0066449687 60 -0.0256146229 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1j55o1256744980.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/2bt8s1256744980.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/3jbkp1256744980.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/4j3kh1256744980.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/5341d1256744980.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/61tx31256744980.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/73z3g1256744980.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/8vmu91256744980.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.783 3.926 4.027 4.011 4.090 4.210 > > #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/9psq31256744980.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/10si1v1256744980.tab") > > system("convert tmp/1j55o1256744980.ps tmp/1j55o1256744980.png") > system("convert tmp/2bt8s1256744980.ps tmp/2bt8s1256744980.png") > system("convert tmp/3jbkp1256744980.ps tmp/3jbkp1256744980.png") > system("convert tmp/4j3kh1256744980.ps tmp/4j3kh1256744980.png") > system("convert tmp/5341d1256744980.ps tmp/5341d1256744980.png") > system("convert tmp/61tx31256744980.ps tmp/61tx31256744980.png") > system("convert tmp/73z3g1256744980.ps tmp/73z3g1256744980.png") > system("convert tmp/8vmu91256744980.ps tmp/8vmu91256744980.png") > > > proc.time() user system elapsed 1.75 1.65 3.26