R version 2.8.1 (2008-12-22) 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(2.28,2.26,2.71,2.77,2.77,2.64,2.56,2.07,2.32,2.16,2.23,2.40,2.84,2.77,2.93,2.91,2.69,2.38,2.58,3.19,2.82,2.72,2.53,2.70,2.42,2.50,2.31,2.41,2.56,2.76,2.71,2.44,2.46,2.12,1.99,1.86,1.88,1.82,1.74,1.71,1.38,1.27,1.19,1.28,1.19,1.22,1.47,1.46,1.96,1.88,2.03,2.04,1.90,1.80,1.92,1.92,1.97,2.46,2.36,2.53,2.31,1.98,1.46,1.26,1.58,1.74,1.89,1.85,1.62,1.30,1.42,1.15,0.42,0.74,1.02,1.51,1.86,1.59,1.03,0.44,0.82,0.86,0.58,0.59,0.95,0.98,1.23,1.17,0.84,0.74,0.65,0.91,1.19,1.30,1.53,1.94,1.79,1.95,2.26,2.04,2.16,2.75,2.79,2.88,3.36,2.97,3.10,2.49,2.20,2.25,2.09,2.79,3.14,2.93,2.65,2.67,2.26,2.35,2.13,2.18,2.90,2.63,2.67,1.81,1.33,0.88,1.28,1.26,1.26,1.29,1.10,1.37,1.21,1.74,1.76,1.48,1.04,1.62,1.49,1.79,1.80,1.58,1.86,1.74,1.59,1.26,1.13,1.92,2.61,2.26,2.41,2.26,2.03,2.86,2.55,2.27,2.26,2.57,3.07,2.76,2.51,2.87,3.14,3.11,3.16,2.47,2.57,2.89,2.63,2.38,1.69,1.96,2.19,1.87,1.6,1.63,1.22,1.21,1.49,1.64) > x <- c(1145.11 + ,1176.86 + ,1206.41 + ,1192.72 + ,1214.82 + ,1199.07 + ,1157.47 + ,1100.10 + ,1095.63 + ,1105.63 + ,1137.79 + ,1124.72 + ,1152.60 + ,1211.85 + ,1239.62 + ,1244.13 + ,1198.42 + ,1227.99 + ,1304.92 + ,1340.26 + ,1307.32 + ,1356.51 + ,1383.29 + ,1437.87 + ,1494.56 + ,1521.42 + ,1498.76 + ,1488.75 + ,1524.62 + ,1439.27 + ,1423.11 + ,1466.85 + ,1425.83 + ,1363.45 + ,1389.18 + ,1395.89 + ,1368.43 + ,1349.03 + ,1299.88 + ,1365.41 + ,1451.04 + ,1433.75 + ,1464.65 + ,1475.57 + ,1571.16 + ,1429.12 + ,1452.46 + ,1538.09 + ,1631.59 + ,1665.50 + ,1690.60 + ,1711.74 + ,1734.10 + ,1748.09 + ,1703.45 + ,1745.74 + ,1751.01 + ,1795.65 + ,1852.13 + ,1877.10 + ,1989.31 + ,2097.76 + ,2154.87 + ,2152.18 + ,2250.27 + ,2346.90 + ,2525.56 + ,2409.36 + ,2394.36 + ,2401.33 + ,2354.32 + ,2450.41 + ,2504.67 + ,2661.39 + ,2880.40 + ,3064.42 + ,3141.12 + ,3327.70 + ,3564.95 + ,3403.13 + ,3149.90 + ,3006.84 + ,3230.66 + ,3361.13 + ,3484.74 + ,3411.13 + ,3288.18 + ,3280.37 + ,3173.95 + ,3165.26 + ,3092.71 + ,3053.05 + ,3181.96 + ,2999.93 + ,3249.57 + ,3210.52 + ,3030.29 + ,2803.47 + ,2767.63 + ,2882.60 + ,2863.36 + ,2897.06 + ,3012.61 + ,3142.95 + ,3032.93 + ,3045.78 + ,3110.52 + ,3013.24 + ,2987.10 + ,2995.55 + ,2833.18 + ,2848.96 + ,2794.83 + ,2845.26 + ,2915.02 + ,2892.63 + ,2604.42 + ,2641.65 + ,2659.81 + ,2638.53 + ,2720.25 + ,2745.88 + ,2735.70 + ,2811.70 + ,2799.43 + ,2555.28 + ,2304.98 + ,2214.95 + ,2065.81 + ,1940.49 + ,2042.00 + ,1995.37 + ,1946.81 + ,1765.90 + ,1635.25 + ,1833.42 + ,1910.43 + ,1959.67 + ,1969.60 + ,2061.41 + ,2093.48 + ,2120.88 + ,2174.56 + ,2196.72 + ,2350.44 + ,2440.25 + ,2408.64 + ,2472.81 + ,2407.60 + ,2454.62 + ,2448.05 + ,2497.84 + ,2645.64 + ,2756.76 + ,2849.27 + ,2921.44 + ,2981.85 + ,3080.58 + ,3106.22 + ,3119.31 + ,3061.26 + ,3097.31 + ,3161.69 + ,3257.16 + ,3277.01 + ,3295.32 + ,3363.99 + ,3494.17 + ,3667.03 + ,3813.06 + ,3917.96 + ,3895.51 + ,3801.06 + ,3570.12 + ,3701.61 + ,3862.27 + ,3970.10 + ,4138.52 + ,4199.75 + ,4290.89) > 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 0.120752452 2 0.105369762 3 0.559667132 4 0.617676236 5 0.620890174 6 0.488599698 7 0.402549931 8 -0.095793222 9 0.153556719 10 -0.004989010 11 0.069687925 12 0.237787193 13 0.681841701 14 0.620458256 15 0.784496766 16 0.765152642 17 0.538505170 18 0.232805449 19 0.443993156 20 1.059132549 21 0.684342181 22 0.591495739 23 0.405390277 24 0.583327688 25 0.311571950 26 0.395478121 27 0.202182743 28 0.300727018 29 0.455943488 30 0.643531286 31 0.591181184 32 0.327542165 33 0.341576746 34 -0.007494997 35 -0.133753157 36 -0.262777342 37 -0.246770770 38 -0.309592055 39 -0.396739797 40 -0.417209960 41 -0.734757037 42 -0.847271472 43 -0.922777775 44 -0.831189711 45 -0.907288335 46 -0.897944799 47 -0.644550531 48 -0.642097609 49 -0.128500176 50 -0.203568743 51 -0.049918523 52 -0.036844194 53 -0.173592444 54 -0.271557919 55 -0.158049785 56 -0.151899673 57 -0.101133272 58 0.395358593 59 0.303572316 60 0.477203630 61 0.273522005 62 -0.040706427 63 -0.552401086 64 -0.752792285 65 -0.418527341 66 -0.244474721 67 -0.068492716 68 -0.125391345 69 -0.357572751 70 -0.676559124 71 -0.563395652 72 -0.819421562 73 -1.541530688 74 -1.198739354 75 -0.886889366 76 -0.370127872 77 -0.008973614 78 -0.251839827 79 -0.777337249 80 -1.390870261 81 -1.047696764 82 -1.028501564 83 -1.275952072 84 -1.246978199 85 -0.869001956 86 -0.849706844 87 -0.617587106 88 -0.678722891 89 -1.024199243 90 -1.125463004 91 -1.226013740 92 -0.971781378 93 -0.673034372 94 -0.589506466 95 -0.323202046 96 0.081119026 97 -0.095091299 98 0.031922928 99 0.336710821 100 0.133430574 101 0.250632556 102 0.845533449 103 0.902337550 104 1.011292518 105 1.475292629 106 1.087161367 107 1.226576317 108 0.602429169 109 0.308627705 110 0.359856564 111 0.176243567 112 0.878538406 113 1.220666437 114 1.018000326 115 0.748145320 116 0.764889207 117 0.312975664 118 0.408389915 119 0.191030871 120 0.237936183 121 0.969820485 122 0.703547781 123 0.742067333 124 -0.106880207 125 -0.588664598 126 -1.074170623 127 -0.710571025 128 -0.743663826 129 -0.765352823 130 -0.753577746 131 -0.928815442 132 -0.665596707 133 -0.832658647 134 -0.328967863 135 -0.327967912 136 -0.579148625 137 -1.007949285 138 -0.420788455 139 -0.549344363 140 -0.235992702 141 -0.221328855 142 -0.437344153 143 -0.149537626 144 -0.266314962 145 -0.393959909 146 -0.710899102 147 -0.845496052 148 -0.046163995 149 0.634352704 150 0.291190686 151 0.440235230 152 0.297476045 153 0.088970169 154 0.935130028 155 0.638583488 156 0.369078962 157 0.367864213 158 0.692222230 159 1.195950980 160 0.887854621 161 0.629412578 162 0.994655225 163 1.274017821 164 1.257901746 165 1.310788474 166 0.623451244 167 0.733437722 168 1.072369422 169 0.837507949 170 0.608744668 171 -0.066000030 172 0.200735132 173 0.416999542 174 0.063414609 175 -0.187463182 176 -0.134098865 177 -0.528417462 178 -0.513924630 179 -0.225020129 180 -0.061765904 > library(lattice) > postscript(file="/var/www/rcomp/tmp/184p31257771732.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/rcomp/tmp/29axh1257771732.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/rcomp/tmp/31hm91257771732.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/rcomp/tmp/4627m1257771732.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/rcomp/tmp/5noda1257771732.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/rcomp/tmp/6dp3c1257771732.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/rcomp/tmp/72j7u1257771732.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/rcomp/tmp/8u0hk1257771732.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. 1096 1524 2409 2366 3036 4291 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9umet1257771732.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/rcomp/tmp/10ijcb1257771733.tab") > > system("convert tmp/184p31257771732.ps tmp/184p31257771732.png") > system("convert tmp/29axh1257771732.ps tmp/29axh1257771732.png") > system("convert tmp/31hm91257771732.ps tmp/31hm91257771732.png") > system("convert tmp/4627m1257771732.ps tmp/4627m1257771732.png") > system("convert tmp/5noda1257771732.ps tmp/5noda1257771732.png") > system("convert tmp/6dp3c1257771732.ps tmp/6dp3c1257771732.png") > system("convert tmp/72j7u1257771732.ps tmp/72j7u1257771732.png") > system("convert tmp/8u0hk1257771732.ps tmp/8u0hk1257771732.png") > > > proc.time() user system elapsed 2.060 1.720 3.677