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(10519.20,10414.90,12476.80,12384.60,12266.70,12919.90,11497.30,12142.00,13919.40,12656.80,12034.10,13199.70,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(1154.80,1206.70,1199.00,1265.00,1247.10,1116.50,1153.90,1077.40,1132.50,1058.80,1195.10,1263.40,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 -2157.37912 2 -2491.24681 3 -395.28764 4 -779.42343 5 -818.14690 6 412.73210 7 -1175.29818 8 -192.21806 9 1341.45979 10 404.85475 11 -820.73689 12 42.75380 13 -1212.73452 14 -1314.33800 15 1137.61675 16 -74.65235 17 1058.14476 18 1266.49100 19 829.36671 20 1269.96438 21 2576.77509 22 757.42185 23 751.33094 24 890.06484 25 -545.89427 26 -637.87197 27 1083.15089 28 -30.73189 29 513.83067 30 -508.22541 31 200.79595 32 358.35300 33 1411.18384 34 -680.45157 35 -274.08112 36 699.77332 37 -278.94232 38 -491.48941 39 492.45815 40 1235.26433 41 630.21758 42 959.57430 43 1046.54598 44 2997.75772 45 2058.43081 46 1671.19175 47 -144.65989 48 1614.87073 49 -468.34249 50 -160.63529 51 629.05377 52 1412.73437 53 -1484.69571 54 -3082.71035 55 -1966.77012 56 -2070.11284 57 -1648.52283 58 -1710.45257 59 -1566.45150 60 -516.41142 61 -2055.24904 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1g7ji1262167652.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/2mn3z1262167652.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/3o3nn1262167652.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/4e1l01262167652.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/5jdoz1262167652.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/61s2v1262167652.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/7s0tf1262167652.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/8wq181262167652.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 1199 1344 1399 1542 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/91iqn1262167652.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/10wm3f1262167653.tab") > > try(system("convert tmp/1g7ji1262167652.ps tmp/1g7ji1262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/2mn3z1262167652.ps tmp/2mn3z1262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/3o3nn1262167652.ps tmp/3o3nn1262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/4e1l01262167652.ps tmp/4e1l01262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/5jdoz1262167652.ps tmp/5jdoz1262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/61s2v1262167652.ps tmp/61s2v1262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/7s0tf1262167652.ps tmp/7s0tf1262167652.png",intern=TRUE)) character(0) > try(system("convert tmp/8wq181262167652.ps tmp/8wq181262167652.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.651 1.219 2.498