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(8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8) > x <- c(0.7538,0.8211,0.5681,0.3028,0.3375,0.5538,0.6028,0.6844,0.3191,0.3028,-0.0319,0.3681,0.4007,0.5170,0.4864,0.5028,0.7844,0.9844,1.0844,0.9864,1.0517,0.7844,0.1354,-0.2809,-0.5972,-0.5625,-0.3952,-0.2462,-0.1299,-0.0952,-0.1789,-0.3789,-0.2789,-0.5605,-0.9605,-0.6605,-0.7768,-0.9442,-0.9136,-0.8993,-0.5666,-0.2013,-0.1850,-0.4544,-0.8034,-0.9401,-0.5259,0.5905,0.6088,0.2252,-0.6891,-1.2503,-0.9319,-0.1299,0.4375,0.4252,0.2416,-0.2054,-0.2360,0.1498) > 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.074544935 2 0.107245226 3 -0.039755870 4 0.025542979 5 0.090843130 6 0.074544068 7 0.025544280 8 -0.056055366 9 0.009243050 10 0.025542979 11 -0.039758472 12 -0.039756737 13 -0.072356596 14 -0.088656092 15 0.041943775 16 0.025543846 17 -0.056054933 18 -0.056054066 19 -0.056053632 20 0.041945943 21 -0.023353774 22 -0.056054933 23 -0.007057746 24 0.009240449 25 0.025539078 26 0.090839228 27 0.123539953 28 0.074540599 29 0.058241103 30 0.123541254 31 0.107240891 32 0.107240024 33 0.107240457 34 0.188839237 35 0.188837502 36 0.188838803 37 0.205138299 38 0.172537573 39 0.041937706 40 -0.072362232 41 -0.105060790 42 -0.170359206 43 -0.186659135 44 -0.317260303 45 -0.268261816 46 -0.431562409 47 -0.545760613 48 -0.562155773 49 -0.480455694 50 -0.496857357 51 -0.382561321 52 -0.121363754 53 -0.039762374 54 0.058241103 55 0.090843563 56 0.303143510 57 0.286742714 58 0.433740776 59 0.564340643 60 0.678542316 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1b4z41257272313.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/29poj1257272313.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/3oaa61257272313.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/4szwo1257272313.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/57sdp1257272313.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/668731257272313.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/714y01257272313.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/8fe891257272313.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. -1.250e+00 -5.346e-01 -6.355e-02 8.333e-06 5.064e-01 1.084e+00 > > #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/9ak2f1257272313.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/105i2l1257272313.tab") > > system("convert tmp/1b4z41257272313.ps tmp/1b4z41257272313.png") > system("convert tmp/29poj1257272313.ps tmp/29poj1257272313.png") > system("convert tmp/3oaa61257272313.ps tmp/3oaa61257272313.png") > system("convert tmp/4szwo1257272313.ps tmp/4szwo1257272313.png") > system("convert tmp/57sdp1257272313.ps tmp/57sdp1257272313.png") > system("convert tmp/668731257272313.ps tmp/668731257272313.png") > system("convert tmp/714y01257272313.ps tmp/714y01257272313.png") > system("convert tmp/8fe891257272313.ps tmp/8fe891257272313.png") > > > proc.time() user system elapsed 2.030 1.860 3.646