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(-9627.054,-9879.41,-10788.3,-17642.546,-14437.08,-15375.902,-10005.122,-9551.41,-7988.232,-13723.944,-17598.3,-15783.122,-11085.766,-11790.766,-8022.766,-13348.3,-13524.3,-12618.012,-8935.3,-9100.3,-10968.122,-10056.944,-10411.944,-10946.588,-5283.232,-5128.054,-2249.054,-4387.054,-8762.588,-11380.656,-13290.368,-11371.902,-10899.724,-12171.368,-10352.19,-12691.012,-9346.834,-7929.012,-2859.368,-5897.19,-4573.546,-3579.258,-4843.724,-3116.902,4224.742,-2958.436,940.386,-455.08,3108.454,5254.454,3068.742,1027.208,1686.674,2374.208,5331.166,6855.344,10646.632,18059.208,20561.674,23339.386,38642.988,44831.056,40739.412,42120.056,37655.522,40053.7,41048.59,45168.768) > x <- c(-14592.498,-14749.83,-11156.16,-17184.822,-16545.82,-17444.154,-17099.494,-15654.83,-11063.164,-13154.828,-13161.16,-13948.494,-10852.162,-9392.162,-4035.162,-9891.16,-9131.16,-10197.824,-11863.16,-11729.16,-7285.494,-8177.828,-7750.828,-9981.496,-7517.164,-6005.498,-1075.498,-5927.498,-4997.496,-6932.492,-10592.156,-10866.154,-6412.488,-7672.156,-6610.49,-7920.824,-6428.158,-5585.824,-133.156,-3363.49,-2202.822,-2256.486,-3363.488,-3620.154,783.514,-1380.152,-1259.818,-3304.82,-347.822,1289.178,6757.514,1001.516,745.518,1461.516,2010.842,3153.508,11929.844,14782.516,15136.518,22871.182,32275.176,36322.172,44015.504,41091.172,40859.174,41557.84,41163.17,42609.836) > 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 5319.173993 2 5227.964451 3 638.277204 4 -41.144037 5 2509.827588 6 2491.119375 7 7508.883216 8 6482.905853 9 3343.094549 10 -250.241804 11 -4118.112287 12 -1496.511655 13 29.442881 14 -2170.954299 15 -3889.832853 16 -3217.392270 17 -4171.818199 18 -2173.005311 19 3215.418167 20 2913.169384 21 -3506.053713 22 -1680.907393 23 -2473.259856 24 -723.154106 25 2416.123044 26 1022.985241 27 -1147.540851 28 1684.094159 29 -3643.989408 30 -4280.148120 31 -2441.468872 32 -242.361888 33 -4331.827432 34 -4313.263230 35 -3581.490944 36 -4578.210364 37 -2762.887518 38 -2207.821606 39 -2723.043596 40 -2452.213301 41 -2317.377282 42 -1268.124218 43 -1398.749349 44 590.961426 45 3422.172067 46 -1544.882623 47 2230.687922 48 2929.804266 49 3464.648904 50 3933.960423 51 -3852.665432 52 1.350686 53 923.021266 54 877.198150 55 3271.511937 56 3625.320408 57 -1572.506728 58 2918.235257 59 5058.116605 60 -86.359565 61 5585.251955 62 7628.205981 63 -4343.292109 64 32.583277 65 -4194.328014 66 -2511.754922 67 -1112.626289 68 1525.811810 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1x2tp1257357469.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/2k5bd1257357469.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/3o1271257357469.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/41ucf1257357469.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/5eg0a1257357469.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/6lnvd1257357469.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/7rl2e1257357469.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/8ci3r1257357469.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. -1.744e+04 -1.030e+04 -5.757e+03 -2.565e-02 1.073e+03 4.402e+04 > > #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/9oclm1257357470.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/109s131257357470.tab") > > system("convert tmp/1x2tp1257357469.ps tmp/1x2tp1257357469.png") > system("convert tmp/2k5bd1257357469.ps tmp/2k5bd1257357469.png") > system("convert tmp/3o1271257357469.ps tmp/3o1271257357469.png") > system("convert tmp/41ucf1257357469.ps tmp/41ucf1257357469.png") > system("convert tmp/5eg0a1257357469.ps tmp/5eg0a1257357469.png") > system("convert tmp/6lnvd1257357469.ps tmp/6lnvd1257357469.png") > system("convert tmp/7rl2e1257357469.ps tmp/7rl2e1257357469.png") > system("convert tmp/8ci3r1257357469.ps tmp/8ci3r1257357469.png") > > > proc.time() user system elapsed 2.605 1.956 3.033