R version 2.8.0 (2008-10-20) 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(-0.73,-0.78,-0.83,-0.94,-0.95,-0.94,-0.97,-1.15,-1.13,-1.06,-1.02,-0.97,-1.03,-0.89,-0.66,-0.56,-0.56,-0.76,-0.64,-0.58,-0.47,-0.55,-0.72,-0.58,-0.74,-0.75,-0.75,-0.60,-0.77,-0.42,-0.45,-0.10,-0.05,0.02,0.19,0.39,0.59,0.57,0.64,0.75,0.84,1.00,1.06,0.97,1.07,1.15,1.20,1.18,1.20,1.06,1.16,1.05,1.22,1.12,1.45,1.55,1.45,1.35,1.04,0.61,0.52,0.38,0.15,-0.15,-0.40,-0.44,-0.58,-0.61,-0.64) > x <- c(-0.93,-1.19,-1.46,-0.91,-0.23,-0.61,-0.55,-0.91,-1.08,-0.07,-0.42,-0.76,-0.74,-0.24,0.58,0.31,0.21,0.34,0.51,0.79,1.04,0.13,0.00,0.39,0.12,0.10,-0.77,-0.23,-0.27,-0.27,-0.57,-0.44,-0.86,-1.21,-0.78,-0.60,-0.86,-0.80,-0.91,-0.90,-1.26,-1.25,-1.31,-1.54,-1.20,-0.29,0.48,0.66,1.08,0.98,1.93,1.47,2.71,3.27,3.57,3.13,3.08,2.63,1.37,1.19,1.08,1.12,-0.02,0.15,-0.79,-1.53,-2.43,-1.47,-1.80) > 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.413802687 2 -0.375307758 3 -0.333409178 4 -0.630609989 5 -0.872058265 6 -0.732719523 7 -0.783141429 8 -0.840609989 9 -0.762747920 10 -1.036516683 11 -0.877388894 12 -0.711664756 13 -0.778472058 14 -0.808654614 15 -0.857754005 16 -0.665855425 17 -0.631818914 18 -0.876066379 19 -0.813928447 20 -0.849230679 21 -0.824321956 22 -0.594589705 23 -0.720342241 24 -0.713084634 25 -0.781186054 26 -0.784378752 27 -0.488261105 28 -0.522058265 29 -0.678443661 30 -0.328443661 31 -0.256334127 32 0.049418408 33 0.242371755 34 0.431499544 35 0.455142546 36 0.593876826 37 0.882371755 38 0.841949848 39 0.949390011 40 1.055986360 41 1.268517800 42 1.425114149 43 1.505536055 44 1.493820031 45 1.478095893 46 1.248363642 47 1.036282506 48 0.955016786 49 0.832063439 50 0.726099950 51 0.502753094 52 0.549321046 53 0.297268308 54 0.006663845 55 0.234554312 56 0.484314961 57 0.401333216 58 0.454497516 59 0.573357557 60 0.204623277 61 0.152063439 62 -0.001551165 63 0.156465062 64 -0.201397007 65 -0.131453803 66 0.080416380 67 0.246744980 68 -0.110005527 69 -0.027685040 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1m52p1257182289.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/freestat/rcomp/tmp/23m7i1257182289.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/freestat/rcomp/tmp/3lzxr1257182289.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/freestat/rcomp/tmp/4vr601257182289.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/freestat/rcomp/tmp/5gcfu1257182289.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/freestat/rcomp/tmp/6f8mv1257182289.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/freestat/rcomp/tmp/7ik501257182289.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/freestat/rcomp/tmp/8ijad1257182289.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. -2.4300000 -0.9000000 -0.2700000 -0.0005797 0.5800000 3.5700000 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9f20a1257182289.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/freestat/rcomp/tmp/10pmgh1257182289.tab") > > system("convert tmp/1m52p1257182289.ps tmp/1m52p1257182289.png") > system("convert tmp/23m7i1257182289.ps tmp/23m7i1257182289.png") > system("convert tmp/3lzxr1257182289.ps tmp/3lzxr1257182289.png") > system("convert tmp/4vr601257182289.ps tmp/4vr601257182289.png") > system("convert tmp/5gcfu1257182289.ps tmp/5gcfu1257182289.png") > system("convert tmp/6f8mv1257182289.ps tmp/6f8mv1257182289.png") > system("convert tmp/7ik501257182289.ps tmp/7ik501257182289.png") > system("convert tmp/8ijad1257182289.ps tmp/8ijad1257182289.png") > > > proc.time() user system elapsed 2.593 1.946 2.992