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(3.88 + ,3.98 + ,3.29 + ,2.88 + ,3.22 + ,3.62 + ,3.82 + ,3.54 + ,2.53 + ,2.22 + ,2.85 + ,2.78 + ,2.28 + ,2.26 + ,2.71 + ,2.77 + ,2.77 + ,2.64 + ,2.56 + ,2.07 + ,2.32 + ,2.16 + ,2.23 + ,2.4 + ,2.84 + ,2.77 + ,2.93 + ,2.91 + ,2.69 + ,2.38 + ,2.58 + ,3.19 + ,2.82 + ,2.72 + ,2.53 + ,2.7 + ,2.42 + ,2.5 + ,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.9 + ,1.8 + ,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.3 + ,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.3 + ,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.1 + ,2.49 + ,2.2 + ,2.25 + ,2.09 + ,2.79 + ,3.14 + ,2.93 + ,2.65 + ,2.67 + ,2.26 + ,2.35 + ,2.13 + ,2.18 + ,2.9 + ,2.63 + ,2.67 + ,1.81 + ,1.33 + ,0.88 + ,1.28 + ,1.26 + ,1.26 + ,1.29 + ,1.1 + ,1.37 + ,1.21 + ,1.74 + ,1.76 + ,1.48 + ,1.04 + ,1.62 + ,1.49 + ,1.79 + ,1.8 + ,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 + ,1.66 + ,1.77 + ,1.82 + ,1.78 + ,1.28 + ,1.29 + ,1.37 + ,1.12 + ,1.51 + ,2.24 + ,2.94 + ,3.09 + ,3.46 + ,3.64 + ,4.39 + ,4.15 + ,5.21 + ,5.8 + ,5.91 + ,5.39 + ,5.46 + ,4.72 + ,3.14 + ,2.63 + ,2.32 + ,1.93 + ,0.62 + ,0.6 + ,-0.37 + ,-1.1 + ,-1.68 + ,-0.78) > x <- c(4.1,4.1,4,3.9,3.8,3.8,4,4.4,4.6,4.6,4.6,4.7,4.8,4.8,4.7,4.7,4.7,4.6,5,5.4,5.5,5.6,5.6,5.8,6,6.1,6.1,6,6,6.1,6.5,7.1,7.4,7.4,7.5,7.6,7.8,7.8,7.7,7.6,7.5,7.3,7.6,8,8,7.9,7.8,7.7,7.8,7.7,7.5,7.3,7.1,7,7.3,7.8,7.9,7.9,7.8,7.8,7.9,7.8,7.6,7.4,7.2,6.9,7.1,7.5,7.6,7.4,7.3,7.2,7.3,7.2,7.1,7,6.9,6.8,7.2,7.6,7.7,7.6,7.5,7.5,7.6,7.6,7.6,7.5,7.3,7.2,7.4,8,8.2,8,7.7,7.7,7.8,7.8,7.7,7.5,7.3,7.1,7.1,7.2,6.8,6.6,6.4,6.4,6.5,6.3,5.9,5.5,5.2,4.9,5.4,5.8,5.7,5.6,5.5,5.4,5.4,5.4,5.5,5.8,5.7,5.4,5.6,5.8,6.2,6.8,6.7,6.7,6.4,6.3,6.3,6.4,6.3,6,6.3,6.3,6.6,7.5,7.8,7.9,7.8,7.6,7.5,7.6,7.5,7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8,7.5,6.8,6.5,6.6,7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8,8.1) > 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.635439214 2 0.735439214 3 0.003836396 4 -0.447766422 5 -0.149369240 6 0.250630760 7 0.533836396 8 0.420247668 9 -0.506546695 10 -0.816546695 11 -0.186546695 12 -0.214943877 13 -0.673341059 14 -0.693341059 15 -0.284943877 16 -0.224943877 17 -0.224943877 18 -0.396546695 19 -0.310135423 20 -0.633724150 21 -0.342121332 22 -0.460518514 23 -0.390518514 24 -0.137312877 25 0.385892759 26 0.357495577 27 0.517495577 28 0.455892759 29 0.235892759 30 -0.032504423 31 0.333906850 32 1.193523758 33 0.948332213 34 0.848332213 35 0.699935031 36 0.911537849 37 0.714743485 38 0.794743485 39 0.563140667 40 0.621537849 41 0.729935031 42 0.846729395 43 0.921537849 44 0.817949122 45 0.837949122 46 0.456346304 47 0.284743485 48 0.113140667 49 0.174743485 50 0.073140667 51 -0.090064969 52 -0.203270605 53 -0.616476242 54 -0.768079060 55 -0.723270605 56 -0.425256515 57 -0.473653696 58 -0.443653696 59 -0.235256515 60 -0.245256515 61 0.296346304 62 0.174743485 63 0.241537849 64 0.168332213 65 -0.054873423 66 -0.279681878 67 -0.076476242 68 0.089935031 69 0.181537849 70 0.588332213 71 0.446729395 72 0.575126577 73 0.396729395 74 0.025126577 75 -0.536476242 76 -0.778079060 77 -0.499681878 78 -0.381284696 79 -0.064873423 80 0.061537849 81 -0.126859333 82 -0.488462151 83 -0.410064969 84 -0.680064969 85 -1.368462151 86 -1.048462151 87 -0.768462151 88 -0.320064969 89 -0.053270605 90 -0.364873423 91 -0.841667787 92 -1.182050878 93 -0.718845242 94 -0.762050878 95 -1.166859333 96 -1.156859333 97 -0.755256515 98 -0.725256515 99 -0.516859333 100 -0.660064969 101 -1.073270605 102 -1.256476242 103 -1.346476242 104 -1.044873423 105 -0.931284696 106 -0.904490332 107 -0.757695969 108 -0.347695969 109 -0.456093150 110 -0.379298787 111 -0.235710059 112 -0.622121332 113 -0.626929786 114 -0.161738241 115 0.086275850 116 0.342687123 117 0.781084304 118 0.349481486 119 0.437878668 120 -0.213724150 121 -0.503724150 122 -0.453724150 123 -0.572121332 124 0.252687123 125 0.561084304 126 0.226275850 127 0.029481486 128 0.132687123 129 -0.110901605 130 0.228715304 131 -0.032887514 132 0.017112486 133 0.612304031 134 0.300701213 135 0.340701213 136 -0.477695969 137 -0.999298787 138 -1.574107241 139 -1.049298787 140 -1.069298787 141 -0.944490332 142 -0.540064969 143 -0.605256515 144 -0.293653696 145 -0.495256515 146 -0.048462151 147 -0.070064969 148 -0.308462151 149 -0.790064969 150 -0.293270605 151 -0.298462151 152 -0.040064969 153 0.011537849 154 -0.083653696 155 0.196346304 156 0.159551940 157 0.051154758 158 -0.362050878 159 -0.700064969 160 -0.201284696 161 0.363906850 162 0.055509668 163 0.621537849 164 0.637949122 165 0.449551940 166 1.113140667 167 0.719935031 168 0.481537849 169 0.554743485 170 0.864743485 171 1.364743485 172 0.929935031 173 0.679935031 174 0.873523758 175 1.309935031 176 1.279935031 177 1.371537849 178 0.723140667 179 0.823140667 180 1.226346304 181 1.049551940 182 0.841154758 183 0.151154758 184 0.421154758 185 0.526346304 186 -0.043270605 187 -0.479681878 188 -0.574490332 189 -0.942887514 190 -0.869681878 191 -0.548079060 192 -0.356476242 193 -0.294873423 194 -0.226476242 195 -0.259681878 196 -0.258079060 197 -0.841284696 198 -0.997695969 199 -0.792887514 200 -1.084490332 201 -0.777695969 202 -0.089298787 203 0.569098395 204 0.843906850 205 1.338715304 206 1.518715304 207 2.102304031 208 1.737495577 209 2.672687123 210 3.387495577 211 3.955126577 212 3.476729395 213 3.380318122 214 2.307495577 215 0.602687123 216 0.259098395 217 0.323523758 218 0.183140667 219 -1.043653696 220 -1.146859333 221 -2.241667787 222 -2.930064969 223 -3.302050878 224 -2.360448060 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1x2d21256838261.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/2stvm1256838261.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/3181v1256838261.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/4i4d91256838261.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/5a20u1256838261.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/6kb0s1256838261.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/7nei41256838261.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/89fgh1256838261.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. 3.800 6.200 7.200 6.827 7.600 8.200 > > #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/96ved1256838261.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/10khlu1256838261.tab") > > system("convert tmp/1x2d21256838261.ps tmp/1x2d21256838261.png") > system("convert tmp/2stvm1256838261.ps tmp/2stvm1256838261.png") > system("convert tmp/3181v1256838261.ps tmp/3181v1256838261.png") > system("convert tmp/4i4d91256838261.ps tmp/4i4d91256838261.png") > system("convert tmp/5a20u1256838261.ps tmp/5a20u1256838261.png") > system("convert tmp/6kb0s1256838261.ps tmp/6kb0s1256838261.png") > system("convert tmp/7nei41256838261.ps tmp/7nei41256838261.png") > system("convert tmp/89fgh1256838261.ps tmp/89fgh1256838261.png") > > > proc.time() user system elapsed 2.661 2.004 2.994