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(8.00,8.10,7.70,7.50,7.60,7.80,7.80,7.80,7.50,7.50,7.10,7.50,7.50,7.60,7.70,7.70,7.90,8.10,8.20,8.20,8.20,7.90,7.30,6.90,6.60,6.70,6.90,7.00,7.10,7.20,7.10,6.90,7.00,6.80,6.40,6.70,6.60,6.40,6.30,6.20,6.50,6.80,6.80,6.40,6.10,5.80,6.10,7.20,7.30,6.90,6.10,5.80,6.20,7.10,7.70,7.90,7.70,7.40,7.50,8.00) > x <- c(4.00,3.80,4.70,4.30,3.90,4.00,4.30,4.80,4.40,4.30,4.70,4.70,4.90,5.00,4.20,4.30,4.80,4.80,4.80,4.20,4.60,4.80,4.50,4.40,4.30,3.90,3.70,4.00,4.10,3.70,3.80,3.80,3.80,3.30,3.30,3.30,3.20,3.40,4.20,4.90,5.10,5.50,5.60,6.40,6.10,7.10,7.80,7.90,7.40,7.50,6.80,5.20,4.70,4.10,3.90,2.60,2.70,1.80,1.00,0.30) > 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.75378168 2 0.82113132 3 0.56805794 4 0.30275722 5 0.33745650 6 0.55378168 7 0.60275722 8 0.68438312 9 0.31908240 10 0.30275722 11 -0.03194206 12 0.36805794 13 0.40070830 14 0.51703348 15 0.48643204 16 0.50275722 17 0.78438312 18 0.98438312 19 1.08438312 20 0.98643204 21 1.05173276 22 0.78438312 23 0.13540758 24 -0.28091760 25 -0.59724278 26 -0.56254350 27 -0.39519386 28 -0.24621832 29 -0.12989314 30 -0.09519386 31 -0.17886868 32 -0.37886868 33 -0.27886868 34 -0.56049458 35 -0.96049458 36 -0.66049458 37 -0.77681976 38 -0.94416940 39 -0.91356796 40 -0.89929170 41 -0.56664134 42 -0.20134062 43 -0.18501545 44 -0.45441401 45 -0.80338955 46 -0.94013775 47 -0.52586149 48 0.59046369 49 0.60883779 50 0.22516297 51 -0.68911329 52 -1.25031616 53 -0.93194206 54 -0.12989314 55 0.43745650 56 0.42522916 57 0.24155434 58 -0.20537227 59 -0.23597371 60 0.14975003 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1f1ms1258047282.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/2tk6f1258047282.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/3svka1258047282.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/46u5z1258047282.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/5a1ib1258047282.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/60cua1258047282.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/7xbhw1258047282.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/8e0951258047282.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. 0.300 3.800 4.300 4.457 4.825 7.900 > > #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/9cqtc1258047282.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/10di6e1258047282.tab") > > system("convert tmp/1f1ms1258047282.ps tmp/1f1ms1258047282.png") > system("convert tmp/2tk6f1258047282.ps tmp/2tk6f1258047282.png") > system("convert tmp/3svka1258047282.ps tmp/3svka1258047282.png") > system("convert tmp/46u5z1258047282.ps tmp/46u5z1258047282.png") > system("convert tmp/5a1ib1258047282.ps tmp/5a1ib1258047282.png") > system("convert tmp/60cua1258047282.ps tmp/60cua1258047282.png") > system("convert tmp/7xbhw1258047282.ps tmp/7xbhw1258047282.png") > system("convert tmp/8e0951258047282.ps tmp/8e0951258047282.png") > > > proc.time() user system elapsed 2.518 1.885 2.853