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(1076.7,1035.9,1037,1154,1237.2,996.6,1238.2,1153.4,1268.1,1156,1144.5,1232.9,1055.2,1109.7,1079.8,1126.3,1196.8,1130.4,1183.6,1200.9,1426.6,1080.4,1325.4,1230,1125.9,1174.5,1151.9,1439.3,1344.3,1319.1,1257.6,1249.1,1397.1,1348,1548.2,1377.6,1402.9,1167.6,1392.9,1547,1420,1266.4,1280.8,1128.6,1449.5,1511.7,1548.3,1652,1650.5,1370.8,1653.3,1474.3,1418.8,1554.1,1156.6,1223.4,1337.5,1098.9,1037.6,1202.5) > x <- c(-0.200324644,-0.222342622,-0.261671305,-0.293266972,-0.271476757,-0.263440944,-0.27770798,-0.25758361,-0.238544032,-0.195978388,-0.18539989,-0.206363871,-0.203430389,-0.183570737,-0.164327623,-0.170248728,-0.19086878,-0.177141795,-0.183986542,-0.204653059,-0.244514032,-0.235071912,-0.237756046,-0.247719327,-0.241140784,-0.231983761,-0.253168575,-0.278616621,-0.262287267,-0.268040242,-0.280808417,-0.301288893,-0.300918624,-0.294086537,-0.3159773,-0.309100484,-0.329015309,-0.352556294,-0.384173883,-0.376379233,-0.38648635,-0.388522449,-0.439995996,-0.454319274,-0.441926312,-0.441668099,-0.455524953,-0.403796501,-0.362557929,-0.286831767,-0.241532853,-0.296319266,-0.280582004,-0.245687006,-0.266202421,-0.276874024,-0.311154064,-0.337614889,-0.342738227,-0.355434285) > 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 -108.059736 2 -172.500539 3 -213.627924 4 -130.552336 5 -23.956083 6 -255.927994 7 -29.646575 8 -92.838948 9 42.303934 10 -24.093141 11 -24.234960 12 41.655919 13 -132.894388 14 -57.070990 15 -66.309571 16 -26.167088 17 22.193068 18 -29.468205 19 16.382559 20 11.492825 21 194.393918 22 -141.668035 23 100.449998 24 -5.647622 25 -102.684211 26 -44.252273 27 -89.598505 28 170.477813 29 93.010714 30 61.633719 31 -13.575528 32 -44.065509 33 104.332051 34 62.567694 35 239.263482 36 76.047151 37 79.964513 38 -180.611550 39 10.740501 40 173.209652 41 35.357595 42 -120.428574 43 -161.295955 44 -328.874924 45 5.331456 46 67.808700 47 89.530533 48 248.771607 49 291.549649 50 93.157173 51 424.294823 52 186.470403 53 147.867572 54 320.634490 55 -98.893004 56 -43.551153 57 33.742213 58 -233.268896 59 -300.069847 60 -148.801662 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/18z4m1256677562.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/248uj1256677562.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/3bslv1256677562.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/4d3671256677562.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/5cenv1256677562.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/60ggm1256677562.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/77l4n1256677562.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/8fxgx1256677562.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.4555 -0.3312 -0.2742 -0.2852 -0.2371 -0.1643 > > #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/9bqr41256677562.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/10x6mi1256677562.tab") > > system("convert tmp/18z4m1256677562.ps tmp/18z4m1256677562.png") > system("convert tmp/248uj1256677562.ps tmp/248uj1256677562.png") > system("convert tmp/3bslv1256677562.ps tmp/3bslv1256677562.png") > system("convert tmp/4d3671256677562.ps tmp/4d3671256677562.png") > system("convert tmp/5cenv1256677562.ps tmp/5cenv1256677562.png") > system("convert tmp/60ggm1256677562.ps tmp/60ggm1256677562.png") > system("convert tmp/77l4n1256677562.ps tmp/77l4n1256677562.png") > system("convert tmp/8fxgx1256677562.ps tmp/8fxgx1256677562.png") > > > proc.time() user system elapsed 1.604 1.178 2.196