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(1.4,1,-0.8,-2.9,-0.7,-0.7,1.5,3,3.2,3.1,3.9,1,1.3,0.8,1.2,2.9,3.9,4.5,4.5,3.3,2,1.5,1,2.1,3,4,5.1,4.5,4.2,3.3,2.7,1.8,1.4,0.5,-0.4,0.8,0.7,1.9,2,1.1,0.9,0.4,0.7,2.1,2.8,3.9,3.5,2,2,1.5,2.5,3.1,2.7,2.8,2.5,3,3.2,2.8,2.4,2,1.8,1.1,-1.5,-3.7) > x <- c(1.9,1.6,0,-1.3,-0.4,-0.3,1.4,2.6,2.8,2.6,3.4,1.7,1.2,0,0,1.6,2.5,3.2,3.4,2.3,1.9,1.7,1.9,3.3,3.8,4.4,4.5,3.5,3,2.8,2.9,2.6,2.1,1.5,1.1,1.5,1.7,2.3,2.3,1.9,2,1.6,1.2,1.9,2.1,2.4,2.9,2.5,2.3,2.5,2.6,2.4,2.5,2.1,2.2,2.7,3,3.2,3,2.7,2.5,1.6,0.1,-1.9) > 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.33979555 2 -0.36469709 3 -0.16417199 4 -0.63874535 5 0.43595928 6 0.31092647 7 0.38536855 8 0.38497472 9 0.33490908 10 0.48497472 11 0.28471217 12 -0.48972991 13 0.43543418 14 1.43582801 15 1.83582801 16 1.53530291 17 1.41000754 18 1.13477781 19 0.88471217 20 1.06007318 21 0.26020445 22 0.01027009 23 -0.73979555 24 -1.39025501 25 -1.11541910 26 -0.86561602 27 0.10935116 28 0.75967935 29 1.08484345 30 0.43490908 31 -0.29012374 32 -0.81502528 33 -0.58986118 34 -0.73966427 35 -1.13953300 36 -0.43966427 37 -0.78972991 38 -0.33992682 39 -0.23992682 40 -0.63979555 41 -0.96482837 42 -0.96469709 43 -0.16456582 44 0.36020445 45 0.81013882 46 1.53504036 47 0.50987626 48 -0.48999246 49 -0.23992682 50 -0.98999246 51 -0.11502528 52 0.73504036 53 0.21000754 54 0.81013882 55 0.38510600 56 0.25994190 57 0.08484345 58 -0.56522219 59 -0.71515655 60 -0.74005810 61 -0.68999246 62 -0.26469709 63 -0.98920481 64 -0.68854843 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1kzqx1258141979.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/2awno1258141979.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/39msd1258141979.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/4yz9r1258141979.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/5wjgh1258141979.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/69ti31258141979.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/73pt71258141979.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/8ksl91258141979.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.900 1.600 2.300 2.047 2.725 4.500 > > #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/97pmp1258141979.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/10u1851258141979.tab") > > system("convert tmp/1kzqx1258141979.ps tmp/1kzqx1258141979.png") > system("convert tmp/2awno1258141979.ps tmp/2awno1258141979.png") > system("convert tmp/39msd1258141979.ps tmp/39msd1258141979.png") > system("convert tmp/4yz9r1258141979.ps tmp/4yz9r1258141979.png") > system("convert tmp/5wjgh1258141979.ps tmp/5wjgh1258141979.png") > system("convert tmp/69ti31258141979.ps tmp/69ti31258141979.png") > system("convert tmp/73pt71258141979.ps tmp/73pt71258141979.png") > system("convert tmp/8ksl91258141979.ps tmp/8ksl91258141979.png") > > > proc.time() user system elapsed 1.676 1.228 2.918