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(2.382678917,2.382678917,1.104245648,1.104245648,1.104245648,0.95770793,0.95770793,0.95770793,2.506856867,2.506856867,2.506856867,0.589148936,0.589148936,0.589148936,3.421499033,3.421499033,3.421499033,2.304700193,2.304700193,2.304700193,0.170647969,0.170647969,0.170647969,-3.762156673,-3.762156673,-3.762156673,-0.512553191,-0.512553191,-0.512553191,-1.099613153,-1.099613153,-1.099613153,-3.084970986,-3.084970986,-3.084970986,-0.716866538,-0.716866538,-0.716866538,-1.622882012,-1.622882012,-1.622882012,-0.305628627,-0.305628627,-0.305628627,-1.488375242,-1.488375242,-1.488375242,1.604245648,1.604245648,1.604245648,-2.265560928,-2.265560928,-2.265560928,0.417185687,0.417185687,0.417185687,0.193916828,0.193916828,0.193916828) > x <- c(-19.01732108,-18.11732108,-17.49575435,-17.89575435,-17.79575435,-16.54229207,-16.04229207,-16.44229207,-15.79314313,-15.39314313,-15.39314313,-17.61085106,-17.51085106,-18.31085106,-16.67850097,-16.17850097,-16.17850097,-15.39529981,-15.99529981,-15.59529981,-15.42935203,-15.72935203,-15.82935203,-19.06215667,-19.46215667,-19.66215667,-17.01255319,-16.91255319,-17.31255319,-16.59961315,-16.59961315,-16.59961315,-17.98497099,-17.98497099,-17.98497099,-18.01686654,-17.81686654,-17.01686654,-15.02288201,-14.82288201,-14.42288201,-13.50562863,-12.70562863,-13.00562863,-11.18837524,-10.48837524,-10.38837524,-14.39575435,-14.29575435,-14.99575435,-15.16556093,-15.66556093,-16.26556093,-17.28281431,-18.58281431,-18.48281431,-18.90608317,-19.70608317,-20.40608317) > 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 2.4991556 2 2.4589735 3 1.1527892 4 1.1706480 5 1.1661833 6 0.9636825 7 0.9413590 8 0.9592178 9 2.4793843 10 2.4615255 11 2.4615255 12 0.6428312 13 0.6383666 14 0.6740840 15 3.4335549 16 3.4112314 17 3.4112314 18 2.2594652 19 2.2862532 20 2.2683945 21 0.1269333 22 0.1403273 23 0.1447920 24 -3.6436782 25 -3.6258195 26 -3.6168901 27 -0.4855830 28 -0.4900477 29 -0.4721889 30 -1.0910794 31 -1.0910794 32 -1.0910794 33 -3.0145854 34 -3.0145854 35 -3.0145854 36 -0.6450569 37 -0.6539863 38 -0.6897038 39 -1.6847443 40 -1.6936737 41 -1.7115324 42 -0.4352315 43 -0.4709490 44 -0.4575549 45 -1.7214361 46 -1.7526889 47 -1.7571536 48 1.5143841 49 1.5099194 50 1.5411722 51 -2.3210531 52 -2.2987297 53 -2.2719416 54 0.4562222 55 0.5142631 56 0.5097984 57 0.3054271 58 0.3411446 59 0.3723974 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1f8u61256895345.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/2032x1256895345.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/33a7y1256895345.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/4qmbe1256895345.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/5jij71256895345.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/6cj941256895345.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/7j1yv1256895345.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/8o4jh1256895345.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. -20.41 -17.94 -16.60 -16.41 -15.39 -10.39 > > #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/9lg5p1256895345.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/10az6k1256895345.tab") > > system("convert tmp/1f8u61256895345.ps tmp/1f8u61256895345.png") > system("convert tmp/2032x1256895345.ps tmp/2032x1256895345.png") > system("convert tmp/33a7y1256895345.ps tmp/33a7y1256895345.png") > system("convert tmp/4qmbe1256895345.ps tmp/4qmbe1256895345.png") > system("convert tmp/5jij71256895345.ps tmp/5jij71256895345.png") > system("convert tmp/6cj941256895345.ps tmp/6cj941256895345.png") > system("convert tmp/7j1yv1256895345.ps tmp/7j1yv1256895345.png") > system("convert tmp/8o4jh1256895345.ps tmp/8o4jh1256895345.png") > > > proc.time() user system elapsed 1.790 1.540 3.336