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(4.8,4.8,4.7,4.7,4.7,4.6,5.0,5.4,5.5,5.6,5.6,5.8,6.0,6.1,6.1,6.0,6.0,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.0,8.8,7.9,7.8,7.7,7.8,7.7,7.5,7.3,7.1,7.0,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.0,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.0,8.2,8.0,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.0,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.0,7.5,6.8,6.5,6.6,7.6,8.0,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.0,7.1) > x <- c(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.0,8.2,8.1,8.1,8.0,7.9,7.9) > 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 -1.145201812 2 -1.074565940 3 -1.103930068 4 -1.033294197 5 -0.962658325 6 -1.062658325 7 -1.015837683 8 -0.969017041 9 -0.939652913 10 -0.839652913 11 -0.839652913 12 -0.780924656 13 -0.722196399 14 -0.622196399 15 -0.622196399 16 -0.651560527 17 -0.651560527 18 -0.622196399 19 -0.575375757 20 -0.469826858 21 -0.311098601 22 -0.381734473 23 -0.281734473 24 -0.252370344 25 -0.123006216 26 -0.123006216 27 -0.152370344 28 -0.181734473 29 -0.211098601 30 -0.340462730 31 -0.252370344 32 -0.276185574 33 0.523814426 34 -0.305549702 35 -0.264277959 36 -0.293642087 37 -0.193642087 38 -0.223006216 39 -0.281734473 40 -0.340462730 41 -0.399190986 42 -0.428555115 43 -0.481734473 44 -0.334913831 45 -0.376185574 46 -0.305549702 47 -0.334913831 48 -0.264277959 49 -0.234913831 50 -0.264277959 51 -0.323006216 52 -0.381734473 53 -0.369826858 54 -0.528555115 55 -0.540462730 56 -0.493642087 57 -0.393642087 58 -0.452370344 59 -0.411098601 60 -0.440462730 61 -0.269826858 62 -0.369826858 63 -0.328555115 64 -0.287283372 65 -0.316647500 66 -0.416647500 67 -0.299190986 68 -0.323006216 69 -0.293642087 70 -0.252370344 71 -0.211098601 72 -0.211098601 73 -0.181734473 74 -0.111098601 75 -0.040462730 76 -0.069826858 77 -0.128555115 78 -0.157919243 79 -0.169826858 80 0.006357913 81 0.135722041 82 0.147629656 83 0.130173142 84 0.200809014 85 0.300809014 86 0.371444885 87 0.342080757 88 0.283352500 89 0.224624243 90 0.165895986 91 0.024624243 92 -0.016647500 93 -0.204739885 94 -0.192832271 95 -0.180924656 96 -0.110288784 97 0.130982959 98 0.142890574 99 0.025434060 100 -0.303930068 101 -0.392022454 102 -0.621386582 103 -0.474565940 104 -0.427745298 105 -0.386473555 106 -0.415837683 107 -0.374565940 108 -0.333294197 109 -0.121386582 110 0.019885161 111 0.119885161 112 0.278613418 113 0.178613418 114 0.090521033 115 0.149249289 116 0.207977546 117 0.325434060 118 0.430982959 119 0.330982959 120 0.260347087 121 -0.039652913 122 0.001618830 123 0.072254702 124 0.313526445 125 0.354798188 126 0.125434060 127 -0.069017041 128 -0.139652913 129 0.019075344 130 0.777803601 131 1.007167729 132 1.036531858 133 0.865895986 134 0.736531858 135 0.777803601 136 0.948439473 137 1.060347087 138 0.860347087 139 0.665895986 140 0.495260115 141 0.595260115 142 0.895260115 143 0.895260115 144 0.953988372 145 0.842080757 146 0.712716628 147 0.565895986 148 0.430982959 149 0.342890574 150 0.301618830 151 0.312716628 152 0.359537270 153 0.459537270 154 0.483352500 155 0.636531858 156 0.665895986 157 0.724624243 158 0.653988372 159 0.724624243 160 0.636531858 161 0.707167729 162 0.448439473 163 0.353988372 164 0.283352500 165 0.383352500 166 0.624624243 167 0.695260115 168 0.824624243 169 0.883352500 170 0.983352500 171 1.053988372 172 1.124624243 173 0.965895986 174 0.577803601 175 0.036531858 176 -0.192832271 177 -0.092832271 178 0.177803601 179 0.348439473 180 0.448439473 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/14qxl1257797753.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/2twkp1257797753.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/3e5921257797753.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/406g91257797753.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/5z3fr1257797753.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/6wz6q1257797753.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/7hbp21257797753.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/8guoq1257797753.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. 6.000 7.600 8.500 8.397 9.300 10.200 > > #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/92fav1257797753.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/10swfj1257797753.tab") > system("convert tmp/14qxl1257797753.ps tmp/14qxl1257797753.png") > system("convert tmp/2twkp1257797753.ps tmp/2twkp1257797753.png") > system("convert tmp/3e5921257797753.ps tmp/3e5921257797753.png") > system("convert tmp/406g91257797753.ps tmp/406g91257797753.png") > system("convert tmp/5z3fr1257797753.ps tmp/5z3fr1257797753.png") > system("convert tmp/6wz6q1257797753.ps tmp/6wz6q1257797753.png") > system("convert tmp/7hbp21257797753.ps tmp/7hbp21257797753.png") > system("convert tmp/8guoq1257797753.ps tmp/8guoq1257797753.png") > > > proc.time() user system elapsed 1.663 1.222 2.409