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.234280187,1.915198308,1.296116428,1.012903007,1.129689586,0.991525826,2.051066766,2.391525826,2.372443947,2.508312405,2.070148646,1.931984887,2.191525826,2.370148646,2.667853345,2.129689586,2.070148646,1.908312405,2.308312405,2.427394285,2.586935225,2.210607706,2.270148646,2.767853345,2.967853345,3.067853345,2.710607706,2.948771465,2.767853345,1.989230526,1.529689586,1.170148646,1.031984887,1.112903007,1.391525826,1.551066766,1.412903007,1.372443947,1.172443947,1.272443947,0.774739247,0.374739247,0.674739247,0.515198308,0.434280187,0.810607706,1.127394285,1.546476165,2.084639924,2.144180864,2.220508383,1.741885563,2.037294961,2.75408154,3.91362248,3.715917781,3.375458721,2.158672142,0.906017104,1.008312405,1.551066766,2.031984887,1.457952669,1.317493608) > x <- c(3.771054999,3.574474017,2.977893035,2.315926472,2.353959909,2.660797945,4.609088436,5.260797945,4.964216963,4.498831382,3.505669418,3.312507454,3.660797945,3.905669418,4.047121873,3.453959909,3.205669418,3.498831382,4.598831382,4.895412364,4.843702855,3.857378927,3.505669418,3.847121873,3.947121873,3.947121873,3.457378927,3.450540891,3.547121873,3.4022504,4.153959909,4.305669418,3.912507454,3.315926472,3.160797945,3.209088436,3.115926472,3.164216963,3.164216963,3.264216963,2.622764508,2.122764508,2.222764508,1.874474017,1.571054999,2.157378927,2.495412364,2.691993346,2.78515531,2.533445801,2.419769729,1.974898256,2.157803166,2.895836603,4.244127094,4.502674639,4.15096513,3.412931693,2.240283837,2.298831382,2.509088436,2.512507454,1.684731071,1.233021562) > 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 0.079383081 2 -0.130740877 3 -0.419158911 4 -0.335467560 5 -0.239761576 6 -0.547994863 7 -0.568322785 8 -0.589083373 9 -0.443780850 10 -0.049965540 11 0.062345430 12 0.031244550 13 0.097740326 14 0.140639505 15 0.359942086 16 0.150547131 17 0.228624873 18 -0.095700729 19 -0.305392022 20 -0.350694544 21 -0.162492842 22 0.007864285 23 0.262345430 24 0.570795048 25 0.715368567 26 0.815368567 27 0.729570209 28 0.971524051 29 0.737074491 30 0.038748832 31 -0.837438237 32 -1.281066420 33 -1.201314337 34 -0.789732371 35 -0.425127268 36 -0.292352048 37 -0.378879409 38 -0.446104189 39 -0.646104189 40 -0.601530670 41 -0.743700846 42 -0.866568440 43 -0.621994921 44 -0.588490697 45 -0.501234333 46 -0.449885535 47 -0.320458996 48 -0.010335037 49 0.476192324 50 0.675246988 51 0.814581153 52 0.582534936 53 0.776566579 54 1.084287194 55 1.496518159 56 1.155509653 57 1.009990798 58 0.202270183 59 -0.400427412 60 -0.330582955 61 0.095633320 62 0.574656400 63 0.459431503 64 0.569339128 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1u6i71257285547.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/2ndd11257285547.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/3ty3f1257285547.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/4fs851257285548.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/5kbeb1257285548.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/6glrj1257285548.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/724no1257285548.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/8qhaq1257285548.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. 1.233 2.512 3.314 3.265 3.907 5.261 > > #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/9ksjz1257285548.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/10me651257285548.tab") > > system("convert tmp/1u6i71257285547.ps tmp/1u6i71257285547.png") > system("convert tmp/2ndd11257285547.ps tmp/2ndd11257285547.png") > system("convert tmp/3ty3f1257285547.ps tmp/3ty3f1257285547.png") > system("convert tmp/4fs851257285548.ps tmp/4fs851257285548.png") > system("convert tmp/5kbeb1257285548.ps tmp/5kbeb1257285548.png") > system("convert tmp/6glrj1257285548.ps tmp/6glrj1257285548.png") > system("convert tmp/724no1257285548.ps tmp/724no1257285548.png") > system("convert tmp/8qhaq1257285548.ps tmp/8qhaq1257285548.png") > > > proc.time() user system elapsed 1.960 1.680 3.471