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(0.523666617,-0.373533875,-0.784207621,-0.402492632,0.114567387,0.703718879,1.151838116,0.675372619,0.346588624,0.400306876,0.459449381,0.48560863,0.662686623,0.324453875,0.229878128,0.147813616,-0.116228858,0.18158413,0.633727867,0.586833622,0.64518887,0.714392625,0.847988378,0.982196626,1.280009615,0.982196626,0.867323619,0.361899366,-0.625677612,-0.621827873,-0.234076134,0.000132114,0.027691117,-0.091644125,0.088845872,-0.025239877,0.046413862,-0.109141878,-0.24474988,-0.485782136,-0.682807867,-0.547374626,-0.580357883,-0.48114514,-0.764259883,-0.731889123,-0.216578381,-0.174321133,-0.634688631,-0.783769886,-1.24877438,-0.811941385,-0.11237912,0.064086377,0.006168864,-0.815965885,-1.443962623,-1.146587369,-0.312991616,0.331277882,0.730490625) > x <- c(0.691734054,-0.603641425,-1.069413377,-0.147448407,1.029183073,2.01250241,2.333930551,1.319397202,0.32649893,0.257176114,0.346193629,0.485376091,0.650611214,0.19334454,-0.148315129,0.42790248,0.533270766,1.17934802,1.606804232,0.78677964,0.47418667,0.378274362,0.378811191,0.430049794,0.676127048,0.030049794,0.30734106,0.449000729,0.368902363,1.024021723,1.2550288,0.806267403,0.397762125,0.069232256,0.289793676,0.268695427,0.675590219,0.392807711,0.089256847,-0.172634349,-0.817101116,-0.764458963,-0.914294017,-0.415904503,-0.690181733,-0.991048454,-0.768546656,-1.00525191,-1.595672975,-1.669620313,-2.216771224,-1.61181681,-0.911609874,-0.297076525,-0.184690491,-0.617844881,-1.509132667,-1.362848477,-0.962311649,-0.796002868,-0.697613354) > 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.197334539 2 -0.088760328 3 -0.279701753 4 -0.332932452 5 -0.370959454 6 -0.245698153 7 0.050784321 8 0.052934519 9 0.192559668 10 0.278981614 11 0.296129265 12 0.256627872 13 0.355754634 14 0.233241761 15 0.299847192 16 -0.054053423 17 -0.367804382 18 -0.374784444 19 -0.124297215 20 0.215662891 21 0.421486827 22 0.535938120 23 0.669280619 24 0.779316571 25 0.961040290 26 0.968020352 27 0.722332569 28 0.150079029 29 -0.799710788 30 -1.104919799 31 -0.826147832 32 -0.380232153 33 -0.159956925 34 -0.124305096 35 -0.047867033 36 -0.151999484 37 -0.272302209 38 -0.294452628 39 -0.286857641 40 -0.404340250 41 -0.297332693 42 -0.186733885 43 -0.149031039 44 -0.284938260 45 -0.438660128 46 -0.264352648 47 0.145990768 48 0.299915956 49 0.118085176 50 0.003889276 51 -0.202991604 52 -0.051551572 53 0.317681454 54 0.204235035 55 0.093298349 56 -0.524491723 57 -0.732015025 58 -0.503650720 59 0.140987999 60 0.706799758 61 1.059596318 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1xgue1256747452.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/2nqe21256747453.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/3nnge1256747453.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/4kath1256747453.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/5xx121256747453.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/6loaa1256747453.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/7fb4i1256747453.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/899na1256747453.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. -2.217e+00 -7.645e-01 2.572e-01 -4.918e-11 4.854e-01 2.334e+00 > > #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/999va1256747453.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/10clyo1256747453.tab") > > system("convert tmp/1xgue1256747452.ps tmp/1xgue1256747452.png") > system("convert tmp/2nqe21256747453.ps tmp/2nqe21256747453.png") > system("convert tmp/3nnge1256747453.ps tmp/3nnge1256747453.png") > system("convert tmp/4kath1256747453.ps tmp/4kath1256747453.png") > system("convert tmp/5xx121256747453.ps tmp/5xx121256747453.png") > system("convert tmp/6loaa1256747453.ps tmp/6loaa1256747453.png") > system("convert tmp/7fb4i1256747453.ps tmp/7fb4i1256747453.png") > system("convert tmp/899na1256747453.ps tmp/899na1256747453.png") > > > proc.time() user system elapsed 1.690 1.420 3.381