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(6368.04,6955.56,12904.96,12746.41,10816.00,12078.01,9801.00,11299.69,16615.21,12343.21,10588.41,16900.00,7569.00,7656.25,13829.76,10691.56,12276.64,12678.76,10506.25,12633.76,18387.36,11046.01,16307.29,18769.00,8281.00,8190.25,14981.76,15202.89,15450.49,14400.00,13947.61,14161.00,20363.29,15276.96,16796.16,22982.56,12188.16,9840.64,17030.25,18550.44,16822.09,16384.00,14786.56,18441.64,20678.44,21756.25,18550.44,24523.56,15202.89,10920.25,19544.04,18632.25,12566.41,14042.25,8911.36,10465.29,12409.96,9840.64,7708.84,13409.64) > x <- c(12071.42,9166.15,15143.76,15225.09,14467.28,13301.01,12188.16,13107.96,17431.92,15168.39,14118.19,16466.02,12597.82,10926.52,17574.80,15011.15,17371.24,15512.70,14631.32,15030.76,21176.07,14058.84,18023.06,18686.89,14730.68,12461.26,18068.74,18947.52,19005.38,14344.85,17079.88,16455.76,21741.50,16491.70,18741.61,20721.60,18398.21,15001.35,18722.45,23421.24,20366.14,15242.37,20842.70,21359.82,21788.71,25125.42,21726.76,27241.50,23913.53,15926.44,24762.17,23762.22,15180.70,12784.82,12199.20,12898.14,14991.55,13208.90,12510.42,15886.08) > 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 -3022.36102 2 283.85051 3 639.52681 4 404.86988 5 -816.39721 6 1536.98411 7 301.35611 8 939.31631 9 2208.56404 10 54.72856 11 -717.31602 12 3397.22327 13 -2313.99524 14 -662.77730 15 -710.59010 16 -1449.77950 17 -2073.22287 18 68.08039 19 -1279.65245 20 474.06987 21 477.01598 22 -204.17751 23 1347.46747 24 3187.97910 25 -3597.88148 26 -1564.95522 27 -20.80893 28 -622.02306 29 -428.56725 30 2882.17025 31 -129.60421 32 667.82437 33 1923.82829 34 1750.15246 35 1163.93325 36 5497.49960 37 -3122.72014 38 -2291.52886 39 1415.95278 40 -1460.88763 41 -330.33829 42 4026.28961 43 -2811.82328 44 359.34653 45 2194.80015 46 150.18600 47 124.77167 48 937.31214 49 -5269.11243 50 -2077.59894 51 -1722.10217 52 -1698.15966 53 266.40912 54 3984.26403 55 -598.61490 56 301.26152 57 286.96177 58 -614.19126 59 -2092.36813 60 449.55912 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/19c4q1256686161.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/22yvx1256686161.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/3jnhb1256686161.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/4nio51256686161.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/5bu391256686161.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/6gj581256686161.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/7qdmo1256686161.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/8mjj41256686161.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. 9166 14290 15910 16910 18960 27240 > > #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/9klhr1256686161.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/10gw181256686161.tab") > > system("convert tmp/19c4q1256686161.ps tmp/19c4q1256686161.png") > system("convert tmp/22yvx1256686161.ps tmp/22yvx1256686161.png") > system("convert tmp/3jnhb1256686161.ps tmp/3jnhb1256686161.png") > system("convert tmp/4nio51256686161.ps tmp/4nio51256686161.png") > system("convert tmp/5bu391256686161.ps tmp/5bu391256686161.png") > system("convert tmp/6gj581256686161.ps tmp/6gj581256686161.png") > system("convert tmp/7qdmo1256686161.ps tmp/7qdmo1256686161.png") > system("convert tmp/8mjj41256686161.ps tmp/8mjj41256686161.png") > > > proc.time() user system elapsed 2.650 2.023 3.020