R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(10881.30,11301.20,13643.90,12517.00,13981.10,14275.70,13425.00,13565.70,16216.30,12970.00,14079.90,14235.00,12213.40,12581.00,14130.40,14210.80,14378.50,13142.80,13714.70,13621.90,15379.80,13306.30,14391.20,14909.90,14025.40,12951.20,14344.30,16093.40,15413.60,14705.70,15972.80,16241.40,16626.40,17136.20,15622.90,18003.90,16136.10,14423.70,16789.40,16782.20,14133.80,12607.00,12004.50,12175.40,13268.00,12299.30,11800.60,13873.30,12315.00) > x <- c(1023.10,1141.00,1116.30,1135.60,1210.50,1230.00,1136.50,1068.70,1372.50,1049.90,1302.20,1305.90,1173.50,1277.40,1238.60,1508.60,1423.40,1375.10,1344.10,1287.50,1446.90,1451.00,1604.40,1501.50,1522.80,1328.00,1420.50,1648.00,1631.10,1396.60,1663.40,1283.00,1582.40,1785.20,1853.60,1994.10,2042.80,1586.10,1942.40,1763.60,1819.90,1836.00,1447.50,1509.50,1661.20,1456.20,1310.90,1542.10,1537.70) > 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 -1567.988948 2 -1609.521879 3 829.848124 4 -372.587547 5 798.371431 6 1016.653007 7 531.890065 8 937.943353 9 2399.541448 10 415.822142 11 538.279151 12 678.898219 13 -824.519252 14 -863.559469 15 837.694625 16 -138.622012 17 362.530793 18 -684.134341 19 9.092384 20 137.811501 21 1271.857308 22 -817.689129 23 -333.160730 24 588.265722 25 -379.597480 26 -691.395995 27 339.680713 28 1198.399102 29 584.741736 30 794.619704 31 1017.527116 32 2774.923445 33 1988.142107 34 1704.230500 35 -76.771048 36 1754.344924 37 -304.055447 38 -229.038825 39 742.186591 40 1434.767831 41 -1433.977157 42 -3023.788779 43 -2105.790951 44 -2177.544401 45 -1678.662600 46 -1845.040709 47 -1775.070608 48 -607.233150 49 -2148.312583 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/124mk1257626180.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/rcomp/tmp/2qpch1257626180.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/rcomp/tmp/384e91257626180.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/rcomp/tmp/4x0vn1257626180.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/rcomp/tmp/54mvm1257626180.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/rcomp/tmp/6t76r1257626180.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/rcomp/tmp/79ser1257626180.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/rcomp/tmp/8xhpm1257626180.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. 1023 1283 1447 1455 1604 2043 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/9g5mv1257626180.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/rcomp/tmp/10mrk01257626180.tab") > > system("convert tmp/124mk1257626180.ps tmp/124mk1257626180.png") > system("convert tmp/2qpch1257626180.ps tmp/2qpch1257626180.png") > system("convert tmp/384e91257626180.ps tmp/384e91257626180.png") > system("convert tmp/4x0vn1257626180.ps tmp/4x0vn1257626180.png") > system("convert tmp/54mvm1257626180.ps tmp/54mvm1257626180.png") > system("convert tmp/6t76r1257626180.ps tmp/6t76r1257626180.png") > system("convert tmp/79ser1257626180.ps tmp/79ser1257626180.png") > system("convert tmp/8xhpm1257626180.ps tmp/8xhpm1257626180.png") > > > proc.time() user system elapsed 1.598 1.187 1.985