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(2.04,2.11,2.08,2.08,2.11,2.04,2.02,2.08,2.05,2.04,2.08,1.99,2.03,2.10,2.07,2.08,2.07,2.05,2.05,2.12,2.04,2.07,2.09,2.01,2.05,2.11,2.11,2.10,2.08,2.06,2.06,2.11,2.05,2.07,2.10,2.05,2.06,2.08,2.12,2.10,2.08,2.07,2.07,2.08,2.11,2.05,2.10,2.06,2.02,2.12,2.11,2.05,2.10,2.03,2.03,2.08,2.04,2.03,2.07,2.02) > x <- c(1.92,2.06,2.05,2.02,2.04,2.00,2.03,2.11,2.05,2.01,2.11,1.94,1.94,2.07,2.01,2.04,2.05,2.01,2.05,2.13,2.02,2.11,2.14,1.96,1.96,2.09,2.09,2.09,2.08,2.07,2.08,2.15,2.09,2.11,2.18,2.04,2.00,2.12,2.13,2.11,2.11,2.08,2.13,2.16,2.17,2.13,2.19,2.09,2.02,2.15,2.14,2.05,2.07,1.97,2.01,2.05,2.00,1.94,2.06,1.90) > 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.020029366 2 0.041627636 3 0.015084902 4 0.025456701 5 0.048542168 6 -0.007628766 7 -0.038000565 8 -0.005658697 9 -0.014915098 10 -0.011086032 11 -0.005658697 12 -0.036885167 13 0.003114833 14 0.028170369 15 0.018913968 16 0.018542168 17 0.005084902 18 -0.001086032 19 -0.014915098 20 0.027426771 21 -0.014543299 22 -0.015658697 23 -0.006030496 24 -0.023799700 25 0.016200300 26 0.031255836 27 0.031255836 28 0.021255836 29 0.004713103 30 -0.011829631 31 -0.015286897 32 0.010512238 33 -0.028744164 34 -0.015658697 35 -0.009859562 36 -0.011457832 37 0.012371234 38 -0.009115963 39 0.027426771 40 0.014341303 41 -0.005658697 42 -0.005286897 43 -0.022573229 44 -0.022945029 45 0.003597705 46 -0.042573229 47 -0.013316828 48 -0.018744164 49 -0.034543299 50 0.020512238 51 0.013969504 52 -0.014915098 53 0.028170369 54 -0.007256967 55 -0.021086032 56 0.015084902 57 -0.007628766 58 0.003114833 59 0.001627636 60 0.006943898 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/13j9v1256804078.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/2srcd1256804078.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/3m53l1256804078.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/4msju1256804078.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/5li8y1256804078.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/6t5pp1256804078.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/7dgy71256804078.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/83jfi1256804078.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 2.018 2.065 2.061 2.110 2.190 > > #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/9axl41256804078.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/10oaqc1256804079.tab") > > system("convert tmp/13j9v1256804078.ps tmp/13j9v1256804078.png") > system("convert tmp/2srcd1256804078.ps tmp/2srcd1256804078.png") > system("convert tmp/3m53l1256804078.ps tmp/3m53l1256804078.png") > system("convert tmp/4msju1256804078.ps tmp/4msju1256804078.png") > system("convert tmp/5li8y1256804078.ps tmp/5li8y1256804078.png") > system("convert tmp/6t5pp1256804078.ps tmp/6t5pp1256804078.png") > system("convert tmp/7dgy71256804078.ps tmp/7dgy71256804078.png") > system("convert tmp/83jfi1256804078.ps tmp/83jfi1256804078.png") > > > proc.time() user system elapsed 2.642 1.965 3.129