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(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) > x <- 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) > 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.345304808 2 -1.455491113 3 -1.326299261 4 -1.395740347 5 -1.495740347 6 -1.561951327 7 -1.102696545 8 -0.852261006 9 -0.624932199 10 -0.706422635 11 -0.670770570 12 -0.384186981 13 0.039911719 14 0.004259653 15 0.085750089 16 -0.024436216 17 -0.136485565 18 -0.194373286 19 0.407489760 20 1.418172048 21 1.429725414 22 1.478793891 23 1.382023998 24 1.568607587 25 1.525999323 26 1.566744542 27 1.369974649 28 1.320906171 29 1.297303455 30 1.299166500 31 1.573700739 32 2.036185628 33 2.046371932 34 1.773204755 35 1.506993776 36 1.340782797 37 1.350969101 38 1.220410188 39 0.979664969 40 0.764385513 41 0.396311488 42 0.240286813 43 0.699541595 44 1.245379965 45 1.399541595 46 1.314821052 47 1.342149858 48 1.237056706 49 1.591714319 50 1.450969101 51 1.327366385 52 1.132459537 53 0.761155406 54 0.510223883 55 0.871341710 56 1.371341710 57 1.396807472 58 1.446371932 59 1.195440410 60 1.182023998 61 0.969974649 62 0.801900624 63 0.337056706 64 0.035193661 65 0.098174533 66 0.179664969 67 0.656062253 68 1.235689644 69 1.218547142 70 0.855566270 71 0.716684097 72 0.579168986 73 0.307368870 74 0.370349743 75 0.412958006 76 0.562522467 77 0.540782797 78 0.303267685 79 0.318051159 80 0.617555175 81 0.911094961 82 0.631467570 83 0.088859307 84 -0.006047541 85 0.177305940 86 0.092585397 87 0.119914204 88 -0.110644710 89 -0.478718734 90 -0.729650257 91 -0.575488627 92 -0.243066669 93 -0.400458405 94 -0.644433730 95 -0.827291228 96 -0.718471985 97 -0.994869269 98 -1.213378833 99 -1.455491113 100 -1.667540463 101 -1.906422635 102 -1.705926652 103 -1.185554043 104 -0.639715672 105 -0.595244364 106 -0.893877302 107 -1.027666323 108 -1.538348611 109 -1.986050026 110 -2.160584265 111 -2.242074701 112 -1.685554043 113 -1.507293714 114 -1.914249911 115 -1.856858174 116 -1.646671870 117 -1.455491113 118 -0.709652742 119 -0.821702092 120 -0.696236331 121 -0.329529368 122 -0.667044479 123 -0.746671870 124 -1.384682965 125 -1.829154273 126 -2.158346125 127 -1.254620035 128 -1.164806339 129 -0.964806339 130 -0.749526882 131 -0.746296776 132 -0.508781664 133 -0.490272101 134 -0.320335031 135 -0.510148726 136 -0.752756989 137 -1.276855689 138 -0.981452858 139 -0.347663837 140 -0.094869269 141 -0.089776117 142 -0.201825467 143 -0.059217203 144 0.079664969 145 0.303267685 146 0.035193661 147 -0.531017319 148 -0.928658290 149 -0.877230784 150 -0.855491113 151 0.620906171 152 1.044508887 153 0.927366385 154 0.750098023 155 0.092210303 156 0.049602039 157 0.244508887 158 0.502396607 159 0.657054221 160 0.199166500 161 -0.028162306 162 -0.044808825 163 0.792706286 164 0.877426830 165 0.902892591 166 0.351465085 167 0.302396607 168 0.565377480 169 0.632955521 170 0.505626714 171 0.054199208 172 0.091714319 173 0.008856821 174 -0.454124051 175 -0.391639162 176 -0.476359705 177 -0.685178948 178 -0.790272101 179 -0.747663837 180 -0.671266553 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15lit1257512909.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/2q8cy1257512909.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/3zc2r1257512909.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/4zu071257512909.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/5thwg1257512909.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/6yvi11257512909.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/7hgol1257512909.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/8i37l1257512909.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. 0.420 1.468 1.975 1.982 2.535 3.360 > > #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/96ks51257512909.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/10uw3h1257512909.tab") > > system("convert tmp/15lit1257512909.ps tmp/15lit1257512909.png") > system("convert tmp/2q8cy1257512909.ps tmp/2q8cy1257512909.png") > system("convert tmp/3zc2r1257512909.ps tmp/3zc2r1257512909.png") > system("convert tmp/4zu071257512909.ps tmp/4zu071257512909.png") > system("convert tmp/5thwg1257512909.ps tmp/5thwg1257512909.png") > system("convert tmp/6yvi11257512909.ps tmp/6yvi11257512909.png") > system("convert tmp/7hgol1257512909.ps tmp/7hgol1257512909.png") > system("convert tmp/8i37l1257512909.ps tmp/8i37l1257512909.png") > > > proc.time() user system elapsed 1.596 1.206 2.271