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(9.9,9.8,9.3,8.3,8,8.5,10.4,11.1,10.9,10,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.8,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8,7.9,7.6,7.1,6.8,6.5,6.9,8.2,8.7,8.3,7.9,7.5,7.8,8.3,8.4,8.2,7.7,7.2,7.3,8.1,8.5) > x <- c(67.24,64,56.25,46.24,42.25,43.56,57.76,64,65.61,59.29,56.25,57.76,60.84,60.84,60.84,56.25,56.25,50.41,56.25,56.25,57.76,59.29,59.29,62.41,65.61,67.24,67.24,67.24,62.41,53.29,47.61,43.56,44.89,47.61,49,50.41,51.84,50.41,47.61,49,46.24,40.96,44.89,43.56,40.96,39.69,38.44,42.25,46.24,46.24,40.96,37.21,33.64,37.21,51.84,53.29,47.61,37.21,33.64,38.44,50.41,59.29,62.41,59.29,54.76,56.25,64,65.61) > 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.157728950 2 0.265176645 3 0.261386409 4 -0.097702656 5 -0.142234661 6 0.273889882 7 1.264705539 8 1.565176645 9 1.262093068 10 0.766744127 11 0.161386409 12 0.064705539 13 0.167502174 14 0.267502174 15 0.167502174 16 0.061386409 17 -0.138613591 18 0.335304477 19 1.061386409 20 1.261386409 21 1.064705539 22 0.366744127 23 -0.033255873 24 -0.133020320 25 -0.237906932 26 -0.342271050 27 -0.542271050 28 -0.742271050 29 -0.433020320 30 0.150906526 31 1.314580263 32 1.773889882 33 1.488733884 34 0.814580263 35 0.425582641 36 0.335304477 37 0.343745772 38 0.435304477 39 0.614580263 40 0.625582641 41 0.402297344 42 0.240360255 43 0.088733884 44 -0.126110118 45 -0.359639745 46 -0.078325371 47 0.001708462 48 -0.142234661 49 -0.497702656 50 -0.797702656 51 -0.959639745 52 -1.019538246 53 -1.090961619 54 -0.919538246 55 -0.556254228 56 -0.149093474 57 -0.185419737 58 0.080461754 59 -0.090961619 60 -0.098291538 61 -0.364695523 62 -0.833255873 63 -1.233020320 64 -1.533255873 65 -1.743213262 66 -1.738613591 67 -1.434823355 68 -1.137906932 > library(lattice) > postscript(file="/var/www/rcomp/tmp/18cx21256757761.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/2sl3t1256757761.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/3t2mm1256757761.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/4v43w1256757761.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/5cidi1256757761.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/6qrib1256757761.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/7zi951256757761.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/80jsi1256757762.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. 33.64 44.89 52.56 52.27 59.29 67.24 > > #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/9jqed1256757762.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/1027561256757762.tab") > > system("convert tmp/18cx21256757761.ps tmp/18cx21256757761.png") > system("convert tmp/2sl3t1256757761.ps tmp/2sl3t1256757761.png") > system("convert tmp/3t2mm1256757761.ps tmp/3t2mm1256757761.png") > system("convert tmp/4v43w1256757761.ps tmp/4v43w1256757761.png") > system("convert tmp/5cidi1256757761.ps tmp/5cidi1256757761.png") > system("convert tmp/6qrib1256757761.ps tmp/6qrib1256757761.png") > system("convert tmp/7zi951256757761.ps tmp/7zi951256757761.png") > system("convert tmp/80jsi1256757762.ps tmp/80jsi1256757762.png") > > > proc.time() user system elapsed 1.760 1.560 3.278