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(3.144152279,3.144152279,3.039749159,3.039749159,3.039749159,2.985681938,2.985681938,2.985681938,3.025291076,3.025291076,3.025291076,3.04927304,3.04927304,3.04927304,3.109060959,3.109060959,3.109060959,3.020424886,3.020424886,3.020424886,2.912350665,2.912350665,2.912350665,2.867898902,2.867898902,2.867898902,2.917770732,2.917770732,2.917770732,2.850706502,2.850706502,2.850706502,2.785011242,2.785011242,2.785011242,2.917770732,2.917770732,2.917770732,2.791165108,2.791165108,2.791165108,2.821378886,2.821378886,2.821378886,2.694627181,2.694627181,2.694627181,3.063390922,3.063390922,3.063390922,2.778819272,2.778819272,2.778819272,2.975529566,2.975529566,2.975529566) > x <- c(0.587786665,0.993251773,0.832909123,0.641853886,0.693147181,0.832909123,1.029619417,0.875468737,0.832909123,0.993251773,0.993251773,1.064710737,1.098612289,0.78845736,0.832909123,1.029619417,1.029619417,1.029619417,0.78845736,0.955511445,1.029619417,0.916290732,0.875468737,0.832909123,0.641853886,0.530628251,0.693147181,0.741937345,0.530628251,0.587786665,0.587786665,0.587786665,0.262364264,0.262364264,0.262364264,0.182321557,0.336472237,0.78845736,1.064710737,1.131402111,1.252762968,1.280933845,1.481604541,1.410986974,1.62924054,1.757857918,1.774952351,1.686398954,1.704748092,1.568615918,1.16315081,0.993251773,0.741937345,0.641853886,-0.510825624,-0.356674944) > 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.206098034 2 0.216818785 3 0.108176105 4 0.103124485 5 0.104480712 6 0.054108884 7 0.059310027 8 0.055234187 9 0.093718022 10 0.097957582 11 0.097957582 12 0.123828966 13 0.124725344 14 0.116524654 15 0.177487905 16 0.182689048 17 0.182689048 18 0.094052975 19 0.087676500 20 0.092093514 21 -0.014021246 22 -0.017017727 23 -0.018097086 24 -0.063674152 25 -0.068725772 26 -0.071666647 27 -0.017497715 28 -0.016207673 29 -0.021794817 30 -0.087347743 31 -0.087347743 32 -0.087347743 33 -0.161647375 34 -0.161647375 35 -0.161647375 36 -0.031004265 37 -0.026928424 38 -0.014977654 39 -0.134278966 40 -0.132515604 41 -0.129306747 42 -0.098348114 43 -0.093042255 44 -0.094909428 45 -0.215890372 46 -0.212489648 47 -0.212037660 48 0.154384674 49 0.154869836 50 0.151270416 51 -0.144021985 52 -0.148514222 53 -0.155159133 54 0.038904892 55 0.008427324 56 0.012503164 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1vnoi1256758134.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/2qgt81256758134.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/3u9j81256758134.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/4pjpu1256758134.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/5g0h21256758134.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/6mumj1256758134.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/7yvx41256758134.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/8vptp1256758134.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. -0.5108 0.6419 0.8542 0.8748 1.0650 1.7750 > > #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/9vvn91256758134.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/10gbcm1256758134.tab") > > system("convert tmp/1vnoi1256758134.ps tmp/1vnoi1256758134.png") > system("convert tmp/2qgt81256758134.ps tmp/2qgt81256758134.png") > system("convert tmp/3u9j81256758134.ps tmp/3u9j81256758134.png") > system("convert tmp/4pjpu1256758134.ps tmp/4pjpu1256758134.png") > system("convert tmp/5g0h21256758134.ps tmp/5g0h21256758134.png") > system("convert tmp/6mumj1256758134.ps tmp/6mumj1256758134.png") > system("convert tmp/7yvx41256758134.ps tmp/7yvx41256758134.png") > system("convert tmp/8vptp1256758134.ps tmp/8vptp1256758134.png") > > > proc.time() user system elapsed 1.740 1.640 3.221