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(-10.464,-10.464,-9.178,-9.678,-9.578,-8.476,-8.376,-8.476,-9.432,-9.532,-9.732,-9.442,-9.342,-9.342,-10.608,-10.708,-10.608,-8.85,-8.85,-8.95,-7.328,-7.528,-7.828,-6.972,-7.072,-7.072,-7.91,-8.01,-8.01,-6.926,-6.926,-7.026,-6.024,-6.324,-6.824,-8.41,-8.61,-8.91,-7.106,-7.106,-6.906,-7.216,-7.416,-7.716,-6.476,-6.776,-6.376,-10.588,-10.388,-10.788,-7.042,-7.342,-7.042,-9.112,-8.812,-8.812,-8.538,-8.938,-8.838,-8.138,-7.938) > x <- c(25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24) > 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.43771700 2 -0.40619075 3 0.28081048 4 -0.75513578 5 -0.87581954 6 0.03702296 7 0.04244420 8 -0.08908205 9 -1.01355580 10 -1.30271330 11 -1.59729206 12 -0.17234702 13 0.05375798 14 0.05375798 15 -1.40139952 16 -1.81666203 17 -1.84276704 18 -0.40002955 19 -0.49460830 20 -0.84681831 21 0.71212919 22 0.38602419 23 0.08602419 24 2.14002172 25 2.26070548 26 2.16612673 27 0.82370671 28 0.25081295 29 -0.09597581 30 0.92497169 31 0.86191918 32 0.82497169 33 2.23681295 34 1.71612919 35 0.96391918 36 0.22912796 37 -0.16002955 38 -0.90139706 39 0.58734043 40 0.24055167 41 0.47207792 42 0.25665668 43 -0.13250083 44 -0.90539459 45 0.01934290 46 -0.56439336 47 0.43460541 48 -1.63360953 49 -0.92918952 50 -1.80208328 51 1.09270794 52 -0.12155333 53 0.39913042 54 -0.88271330 55 -0.14134579 56 -0.04676704 57 -0.05650330 58 -0.92939706 59 -0.67176580 60 1.25775798 61 1.61538924 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1ij721257268737.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/2cs0c1257268737.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/3tink1257268737.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/4bxm11257268737.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/5ng4j1257268737.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/6tbcb1257268737.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/7koi01257268737.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/8yjyd1257268737.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. 13.40 18.80 20.20 20.18 22.00 25.60 > > #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/9s4uq1257268737.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/100nas1257268737.tab") > > system("convert tmp/1ij721257268737.ps tmp/1ij721257268737.png") > system("convert tmp/2cs0c1257268737.ps tmp/2cs0c1257268737.png") > system("convert tmp/3tink1257268737.ps tmp/3tink1257268737.png") > system("convert tmp/4bxm11257268737.ps tmp/4bxm11257268737.png") > system("convert tmp/5ng4j1257268737.ps tmp/5ng4j1257268737.png") > system("convert tmp/6tbcb1257268737.ps tmp/6tbcb1257268737.png") > system("convert tmp/7koi01257268737.ps tmp/7koi01257268737.png") > system("convert tmp/8yjyd1257268737.ps tmp/8yjyd1257268737.png") > > > proc.time() user system elapsed 2.658 1.984 3.540