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.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.8545,0.4211,0.3712,0.4045,0.5378,0.5545,0.6045,0.3879,0.3212,-0.0955,0.3712,0.3712,0.5046,0.6212,0.4878,0.7045,0.9879,1.0879,1.0879,0.9878,0.7545,0.1879,-0.2621,-0.5788,-0.4955,-0.3622,-0.2956,-0.1455,-0.0289,-0.1956,-0.3789,-0.2789,-0.4789,-0.9623,-0.6623,-0.7623,-0.9789,-1.0456,-1.0122,-0.5954,-0.2621,-0.1954,-0.5787,-0.7453,-1.0953,-0.6286,0.5882,0.7048,0.2215,-0.5619,-0.9786,-0.8454,-0.0288,0.4711,0.6378,0.2210,-0.0623,-0.1124,0.2542) > 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.087879600 2 0.121276192 3 -0.028824200 4 0.037876062 5 0.104577110 6 0.087877241 7 0.037877634 8 -0.045524069 9 0.021175407 10 0.037872131 11 -0.028824200 12 -0.028824200 13 -0.062223151 14 -0.078822235 15 0.054576717 16 0.037878420 17 -0.045519352 18 -0.045518565 19 -0.045518565 20 0.054580648 21 -0.012121187 22 -0.045525641 23 0.004470821 24 0.021168331 25 0.037868986 26 0.104570034 27 0.137970557 28 0.087871737 29 0.071272654 30 0.137971344 31 0.121269902 32 0.121270689 33 0.121269116 34 0.204665316 35 0.204667674 36 0.204666888 37 0.221265185 38 0.187964661 39 0.054564923 40 -0.062231800 41 -0.095529179 42 -0.162228655 43 -0.178931668 44 -0.312332978 45 -0.262335730 46 -0.429032061 47 -0.545822494 48 -0.562421577 49 -0.479125377 50 -0.495731536 51 -0.379034813 52 -0.112233765 53 -0.028827345 54 0.071276585 55 0.104577896 56 0.321374619 57 0.304672392 58 0.454771998 59 0.588174880 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1otez1257275357.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/2abvr1257275357.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/3d7ar1257275357.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/4wjqu1257275357.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/55k7k1257275357.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/6fuoi1257275357.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/7dfzb1257275357.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/860q11257275357.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.095e+00 -5.287e-01 -2.890e-02 1.259e-18 4.962e-01 1.088e+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/9pgub1257275357.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/10pa9s1257275357.tab") > > system("convert tmp/1otez1257275357.ps tmp/1otez1257275357.png") > system("convert tmp/2abvr1257275357.ps tmp/2abvr1257275357.png") > system("convert tmp/3d7ar1257275357.ps tmp/3d7ar1257275357.png") > system("convert tmp/4wjqu1257275357.ps tmp/4wjqu1257275357.png") > system("convert tmp/55k7k1257275357.ps tmp/55k7k1257275357.png") > system("convert tmp/6fuoi1257275357.ps tmp/6fuoi1257275357.png") > system("convert tmp/7dfzb1257275357.ps tmp/7dfzb1257275357.png") > system("convert tmp/860q11257275357.ps tmp/860q11257275357.png") > > > proc.time() user system elapsed 1.930 1.820 3.531