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(8892.49,9880.36,13386.49,13642.24,9960.04,9216,13432.81,11902.81,13759.29,12056.04,12723.84,12254.49,10000,12836.89,14981.76,12656.25,10857.64,8556.25,13735.84,11946.49,11257.21,14113.44,11088.09,11236,10404,12746.41,13572.25,13179.04,10100.25,7293.16,13133.16,12078.01,10140.49,13340.25,10140.49,9801,10465.29,11837.44,11214.81,12814.24,9158.49,6544.81,12973.21,9623.61,10567.84,10962.09,9196.81,8949.16,10322.56,10795.21,12166.09,13018.81,9370.24,7638.76,12409.96,9486.76,10588.41,12701.29,9409,9044.01) > x <- c(160,171.4,192,231.2,250.8,268.4,266.9,268.5,268.2,265.3,253.8,243.4,213.6,221,227.3,221.6,222.1,232.2,229.6,238.9,238.2,223.9,215,211.1,210.6,206.6,207,201.7,204.5,204.5,195.1,205.5,187.5,173.5,172.3,167.5,157.5,151.1,148.5,147.9,145.6,139.8,138.9,141.4,148.7,150.9,147.3,144.5,134,135.1,131.4,128.4,127.6,127.4,124,123.5,128,129.9,127.6,121.8) > 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 -1911.68490 2 -1092.90832 3 2107.66691 4 1781.97287 5 -2190.94915 6 -3196.04565 7 1043.01348 8 -510.71893 9 1350.21090 10 -310.02411 11 528.35259 12 213.26325 13 -1599.21062 14 1127.91698 15 3179.34062 16 938.37733 17 -867.64905 18 -3318.84988 19 1899.30528 20 -27.98935 21 -706.88642 22 2361.45199 23 -531.88648 24 -326.12873 25 -1150.71235 26 1251.02867 27 2070.93557 28 1756.33918 29 -1363.98254 30 -4171.07254 31 1808.35537 32 598.94470 33 -1071.58569 34 2335.83290 35 -846.12780 36 -1114.42057 37 -301.80301 38 1165.27663 39 581.21180 40 2189.54145 41 -1432.09321 42 -3959.74323 43 2482.00625 44 -904.67564 45 -68.72476 46 292.89318 47 -1418.98890 48 -1625.10718 49 -95.96324 50 360.37073 51 1786.13192 52 2683.35019 53 -953.35360 54 -2681.86705 55 2139.76432 56 -776.01930 57 258.88329 58 2343.58106 59 -914.59360 60 -1193.55362 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1p15j1257173537.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/2539s1257173537.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/3uu2p1257173537.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/4xvim1257173537.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/53t5v1257173537.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/6xjab1257173537.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/7mob31257173537.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/804181257173537.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. 121.8 143.7 189.8 186.2 222.6 268.5 > > #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/9ul741257173537.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/10sk381257173537.tab") > system("convert tmp/1p15j1257173537.ps tmp/1p15j1257173537.png") > system("convert tmp/2539s1257173537.ps tmp/2539s1257173537.png") > system("convert tmp/3uu2p1257173537.ps tmp/3uu2p1257173537.png") > system("convert tmp/4xvim1257173537.ps tmp/4xvim1257173537.png") > system("convert tmp/53t5v1257173537.ps tmp/53t5v1257173537.png") > system("convert tmp/6xjab1257173537.ps tmp/6xjab1257173537.png") > system("convert tmp/7mob31257173537.ps tmp/7mob31257173537.png") > system("convert tmp/804181257173537.ps tmp/804181257173537.png") > > > proc.time() user system elapsed 1.579 1.150 2.378