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(87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6) > x <- c(4.053522568,4.104294893,4.510859507,4.446174454,4.348986781,4.347693956,4.223909767,4.247065649,4.403054002,4.318820559,4.247065649,4.430816799,3.994524227,4.094344562,4.498697941,4.343805422,4.446174454,4.351567427,4.237000863,4.324132656,4.450852826,4.279440046,4.380775853,4.446174454,3.955082495,4.11414719,4.411585437,4.447346101,4.359269648,4.251348311,4.251348311,4.238444906,4.350277936,4.191168747,4.234106505,4.371976299,4.028916757,4.147885329,4.354141431,4.521788577,4.357990057,4.175924549,4.264087337,4.261270434,4.276666119,4.405498991,4.257030144,4.283586562,4.175924549,4.005513349,4.382026635,4.348986781,4.087655574,4.050044303,3.927896355,4.051784948,4.200204953,4.104294893,4.08933202,4.24563401,3.848017675) > 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 -6.3667371 2 0.3596943 3 -3.7491812 4 -4.1429963 5 -5.4252887 6 -7.6572112 7 -8.1389845 8 -8.0583267 9 -7.4723599 10 -4.9367961 11 -5.8583267 12 0.2657070 13 -9.7600030 14 -0.2163412 15 -4.0087775 16 -3.1524488 17 -5.6429963 18 -7.1611804 19 -4.4283353 20 -7.3165205 21 0.8106501 22 -4.9630974 23 -1.0992374 24 0.1570037 25 -3.1830806 26 3.5408922 27 2.1783919 28 1.9953072 29 3.0332362 30 -2.1838431 31 1.8161569 32 1.7956243 33 9.4067216 34 5.0850918 35 6.0240757 36 6.6641295 37 0.0289555 38 5.4643096 39 2.9032778 40 3.9753160 41 3.5006169 42 -0.2121794 43 5.8453454 44 8.0936778 45 4.2829720 46 4.9988919 47 4.6169630 48 10.0185554 49 -4.2121794 50 8.5613319 51 5.7348990 52 6.3747113 53 3.8358874 54 0.7164214 55 3.8484869 56 -0.4752375 57 1.6092633 58 -2.3403057 59 -3.8523908 60 -1.1829395 61 -0.3452624 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1ve6k1256740726.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/2lrg01256740726.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/3ks1j1256740726.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/4eguf1256740726.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/5om2y1256740726.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/6e3it1256740726.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/7xu8v1256740726.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/8ks4b1256740726.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.848 4.148 4.261 4.255 4.359 4.522 > > #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/9gdux1256740726.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/10ju6f1256740727.tab") > > system("convert tmp/1ve6k1256740726.ps tmp/1ve6k1256740726.png") > system("convert tmp/2lrg01256740726.ps tmp/2lrg01256740726.png") > system("convert tmp/3ks1j1256740726.ps tmp/3ks1j1256740726.png") > system("convert tmp/4eguf1256740726.ps tmp/4eguf1256740726.png") > system("convert tmp/5om2y1256740726.ps tmp/5om2y1256740726.png") > system("convert tmp/6e3it1256740726.ps tmp/6e3it1256740726.png") > system("convert tmp/7xu8v1256740726.ps tmp/7xu8v1256740726.png") > system("convert tmp/8ks4b1256740726.ps tmp/8ks4b1256740726.png") > > > proc.time() user system elapsed 1.790 1.600 3.259