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.8651,-0.9651,-3.5609,-4.18485,-5.4567,-3.68485,-4.93275,-3.9609,-7.48065,-8.92855,-9.67645,-8.3525,-7.42855,-7.0046,-8.1046,-6.83275,-4.9609,-6.7567,-5.83275,-5.83275,-5.6088,-4.33695,-3.713,-2.04115,-2.88905,-2.2651,-2.04115,-2.68905,-3.013,-3.113,-1.34115,-0.7172,-0.8172,-0.39325,-1.0172,-2.78905,-2.3651,-2.58905,-1.14115,-0.0172,-0.24115,1.85465,0.2828,2.80255,-0.54115,-0.2172,0.30675,1.25465,0.6307,2.20255,-0.29325,1.15465,2.20255,0.40675,1.9786,0.9307,2.30255,1.6786,1.35465,1.75465) > x <- c(-1.35014,-1.75014,-4.74826,-5.39779,-6.54638,-4.39779,-5.29685,-3.74826,-6.99591,-8.39497,-9.09403,-8.1445,-7.19497,-7.14544,-8.44544,-7.19685,-5.24826,-7.14638,-6.09685,-5.79685,-5.14732,-3.59873,-3.0492,-1.60061,-2.29967,-1.45014,-1.00061,-1.59967,-1.7492,-1.8492,-0.20061,0.34892,0.24892,0.79845,0.54892,-0.59967,0.14986,-0.59967,-0.30061,0.24892,-0.30061,2.09751,0.64892,3.39657,-0.00061,0.44892,1.39845,3.09751,2.64798,4.09657,0.79845,1.79751,3.09657,1.29845,3.04704,1.84798,3.19657,2.64704,2.89751,3.79751) > 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 1.149172165 2 1.392129807 3 1.366900220 4 1.299853413 5 1.012797708 6 0.942459308 7 0.465408052 8 0.109506115 9 -0.625727920 10 -0.874082124 11 -1.022612201 12 -0.512783625 13 -0.402955050 14 -0.021471780 15 -0.006859444 16 0.194456851 17 0.395597272 18 0.227234171 19 0.251323336 20 -0.005894896 21 -0.338848088 22 -0.394750025 23 -0.241963808 24 0.187873666 25 -0.060656411 26 -0.165088425 27 -0.326562797 28 -0.460832284 29 -0.656576144 30 -0.670836733 31 -0.312478081 32 -0.159691863 33 -0.173952453 34 -0.221166235 35 -0.631170684 36 -1.418226389 37 -1.636918993 38 -1.218226389 39 -0.026738670 40 0.626047547 41 0.873261330 42 0.912927379 43 0.583089905 44 0.747020993 45 0.316043098 46 0.254568726 47 -0.035602698 48 -0.544466726 49 -0.782992354 50 -0.453154880 51 -0.121166235 52 0.470145611 53 0.404239225 54 0.150136713 55 0.222755955 56 0.202922930 57 0.418499814 58 0.265713597 59 -0.272987905 60 -0.644642599 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1qt261257440297.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/2t4oq1257440297.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/34rey1257440297.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/4df0x1257440297.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/5o6rg1257440297.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/6mwpv1257440297.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/72zes1257440297.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/8hpdg1257440297.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. -9.0940 -5.1730 -0.8001 -1.6810 0.9235 4.0970 > > #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/9cgll1257440297.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/108wm01257440297.tab") > > system("convert tmp/1qt261257440297.ps tmp/1qt261257440297.png") > system("convert tmp/2t4oq1257440297.ps tmp/2t4oq1257440297.png") > system("convert tmp/34rey1257440297.ps tmp/34rey1257440297.png") > system("convert tmp/4df0x1257440297.ps tmp/4df0x1257440297.png") > system("convert tmp/5o6rg1257440297.ps tmp/5o6rg1257440297.png") > system("convert tmp/6mwpv1257440297.ps tmp/6mwpv1257440297.png") > system("convert tmp/72zes1257440297.ps tmp/72zes1257440297.png") > system("convert tmp/8hpdg1257440297.ps tmp/8hpdg1257440297.png") > > > proc.time() user system elapsed 1.628 1.188 4.691