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(0.82,0.82,1.00,1.02,1.02,0.97,0.94,0.73,0.84,0.77,0.80,0.88,1.04,1.02,1.08,1.07,0.99,0.87,0.95,1.16,1.04,1.00,0.93,0.99,0.88,0.92,0.84,0.88,0.94,1.02,1.00,0.89,0.90,0.75,0.69,0.62,0.63,0.60,0.55,0.54,0.32,0.24,0.17,0.25,0.17,0.20,0.39,0.38,0.67,0.63,0.71,0.71,0.64,0.59,0.65,0.65,0.68,0.90,0.86,0.93,0.84,0.68,0.38,0.23,0.46,0.55,0.64,0.62,0.48,0.26,0.35,0.14,-0.87,-0.30,0.02,0.41,0.62,0.46,0.03,-0.82,-0.20,-0.15,-0.54,-0.53,-0.05,-0.02,0.21,0.16,-0.17,-0.30,-0.43,-0.09,0.17,0.26,0.43,0.66,0.58,0.67,0.82,0.71,0.77,1.01,1.03,1.06,1.21,1.09,1.13,0.91,0.79,0.81,0.74,1.03,1.14,1.08,0.97,0.98,0.82,0.85,0.76,0.78,1.06,0.97,0.98,0.59,0.29,-0.13,0.25,0.23,0.23,0.25,0.10,0.31,0.19,0.55,0.57,0.39,0.04,0.48,0.40,0.58,0.59,0.46,0.62,0.55,0.46,0.23,0.12,0.65,0.96,0.82,0.88,0.82,0.71,1.05,0.94,0.82,0.82,0.94,1.12,1.02,0.92,1.05,1.14,1.13,1.15,0.90,0.94,1.06,0.97,0.87,0.52,0.67,0.78,0.63,0.47,0.49,0.20,0.19,0.40,0.49) > 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.330693303 2 -1.430693303 3 -1.385846673 4 -1.469752603 5 -1.569752603 6 -1.609987778 7 -1.134128883 8 -0.803116618 9 -0.614599233 10 -0.670928478 11 -0.646787373 12 -0.382411093 13 -0.053658533 14 -0.069752603 15 -0.021470393 16 -0.129517428 17 -0.193893708 18 -0.190458128 19 0.373918152 20 1.242905888 21 1.346341467 22 1.414153327 23 1.357824082 24 1.506106292 25 1.517588907 26 1.549777047 27 1.385400767 28 1.317588907 29 1.265871117 30 1.230247397 31 1.514153327 32 2.025635942 33 2.033682977 34 1.812977452 35 1.564695242 36 1.408365997 37 1.416413032 38 1.292271927 39 1.052036751 40 0.843989716 41 0.466954946 42 0.302578666 43 0.746249421 44 1.310625701 45 1.446249421 46 1.370390526 47 1.423284191 48 1.315237156 49 1.648601172 50 1.516413032 51 1.380789312 52 1.180789312 53 0.824460067 54 0.584224891 55 0.932507102 56 1.432507102 57 1.456648207 58 1.433682977 59 1.201494837 60 1.157824082 61 0.985400767 62 0.856648207 63 0.415237156 64 0.094531631 65 0.179613436 66 0.252036751 67 0.724460067 68 1.308365997 69 1.295707506 70 0.918672736 71 0.791096051 72 0.622108316 73 -0.090642221 74 0.268038775 75 0.425543895 76 0.639378261 77 0.608365997 78 0.379613436 79 0.333590930 80 0.249592954 81 0.848509125 82 0.588744300 83 -0.125090066 84 -0.217043031 85 0.169214650 86 0.093355755 87 0.178437561 88 -0.061797614 89 -0.527349770 90 -0.831961225 91 -0.736572680 92 -0.262973490 93 -0.353750579 94 -0.581327264 95 -0.744527669 96 -0.659445863 97 -0.923822144 98 -1.151398828 99 -1.430693303 100 -1.619210688 101 -1.870928478 102 -1.777799638 103 -1.261705568 104 -0.737564463 105 -0.816858937 106 -1.013423358 107 -1.181235218 108 -1.558269988 109 -1.954834408 110 -2.138740338 111 -2.195069583 112 -1.761705568 113 -1.673188182 114 -2.021470393 115 -1.909987778 116 -1.701940743 117 -1.430693303 118 -0.706552198 119 -0.778975513 120 -0.662881443 121 -0.437564463 122 -0.709987778 123 -0.801940743 124 -1.315775109 125 -1.757186159 126 -2.195161630 127 -1.189374299 128 -1.105468369 129 -0.905468369 130 -0.689374299 131 -0.710079824 132 -0.441092089 133 -0.437656509 134 -0.247963249 135 -0.431869179 136 -0.676715809 137 -1.258362035 138 -0.904292494 139 -0.268668774 140 -0.023822144 141 -0.015775109 142 -0.120386564 143 0.008365997 144 0.152036751 145 0.379613436 146 0.094531631 147 -0.493985754 148 -0.867492898 149 -0.918034813 150 -0.830693303 151 0.617588907 152 1.069306697 153 0.980789312 154 0.654388502 155 0.065871117 156 0.069306697 157 0.269306697 158 0.465871117 159 0.510717747 160 0.130247397 161 -0.050222953 162 -0.145611498 163 0.626811818 164 0.718764782 165 0.734858853 166 0.333682977 167 0.265871117 168 0.462435537 169 0.590012222 170 0.509541872 171 0.127895646 172 0.148601172 173 0.037118557 174 -0.383586968 175 -0.312339529 176 -0.396245459 177 -0.629609474 178 -0.737656509 179 -0.668668774 180 -0.596245459 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1d7rk1257515940.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/2s50w1257515940.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/3g1i11257515940.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/4g1w81257515940.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/5wo9b1257515940.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/6u7dx1257515940.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/75aa11257515940.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/87h4p1257515940.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.8700 0.3875 0.6800 0.6131 0.9325 1.2100 > > #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/9re2m1257515940.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/10y9rw1257515940.tab") > > system("convert tmp/1d7rk1257515940.ps tmp/1d7rk1257515940.png") > system("convert tmp/2s50w1257515940.ps tmp/2s50w1257515940.png") > system("convert tmp/3g1i11257515940.ps tmp/3g1i11257515940.png") > system("convert tmp/4g1w81257515940.ps tmp/4g1w81257515940.png") > system("convert tmp/5wo9b1257515940.ps tmp/5wo9b1257515940.png") > system("convert tmp/6u7dx1257515940.ps tmp/6u7dx1257515940.png") > system("convert tmp/75aa11257515940.ps tmp/75aa11257515940.png") > system("convert tmp/87h4p1257515940.ps tmp/87h4p1257515940.png") > > > proc.time() user system elapsed 1.685 1.239 2.850