R version 2.8.0 (2008-10-20) 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(-3.509688829,-4.431724902,-4.38242163,-3.916082284,-3.225403593,-3.079064248,-3.023403593,-3.61242163,-3.009760975,-1.762439666,-0.006064248,-0.076724902,-0.620724902,-1.370403593,-1.382742939,1.890596407,2.110275098,1.207275098,1.080935752,0.161596407,0.908917716,2.289899679,3.52657837,1.971239025,1.386239025,0.869899679,0.236560334,0.587560334,0.485899679,0.530899679,1.038560334,1.914899679,2.191881643,2.893184915,3.662202952,0.873524261,-0.906493776,-0.910493776,-3.181493776,-0.851815085,-1.355475739,-0.53915443,-1.209172467,-1.218529849,-1.402547885,0.699809497,1.322881643,-0.406439666,-1.446797048,-1.585833121,-2.655851158,-1.343833121,-2.177118357,0.731899679,1.341899679,1.989881643,2.177524261,5.002863606,5.225239025,4.071917716,4.21757837) > x <- c(-14.93885623,-14.10024254,-12.58373114,-12.41083342,-12.30703798,-12.45414026,-12.10503798,-11.81373114,-10.91762886,-9.083424295,-9.381140261,-9.745242542,-10.28924254,-10.45203798,-10.1709357,-7.19103798,-7.558242542,-8.461242542,-8.294140261,-8.92003798,-7.585833418,-5.324526576,-4.674731137,-5.936628857,-6.521628857,-6.744526576,-7.084424295,-6.733424295,-7.128526576,-7.083526576,-6.282424295,-5.699526576,-4.542219733,-2.373708329,-2.485015172,-4.68681061,-5.586503768,-5.590503768,-7.861503768,-6.118708329,-6.91581061,-5.512606048,-5.302299206,-4.137890083,-3.44158324,-2.512992363,-5.411219733,-7.727424295,-7.594015172,-5.972401487,-6.162094644,-5.730401487,-8.911219733,-6.882526576,-6.272526576,-4.744219733,-3.38281061,-0.850912891,-2.682628857,-4.422833418,-3.983731137) > 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.99725579 2 -0.41170303 3 -1.24292901 4 -0.87697895 5 -0.24656682 6 -0.01481575 7 -0.16185371 8 -0.92001271 9 -0.83765429 10 -0.65532385 11 1.27391385 12 1.41466124 13 1.18652297 14 0.53136790 15 0.35581265 16 1.89893940 17 2.33182741 18 1.95313466 19 1.72977102 20 1.17384553 21 1.14649006 22 1.21449355 23 2.07388269 24 1.25123673 25 1.00590421 26 0.61898557 27 0.18300042 28 0.33019992 29 0.45794679 30 0.47681852 31 0.51933661 32 1.05722911 33 0.66224611 34 0.10445055 35 0.93809647 36 -0.57215773 37 -1.82978857 38 -1.83146606 39 -2.78385945 40 -1.46609691 41 -1.50693752 42 -1.50535632 43 -2.29748444 44 -2.98293057 45 -3.57124398 46 -2.00805264 47 0.29781200 48 -0.08665566 49 -1.20447414 50 -2.28506482 51 -3.24494167 52 -2.18357684 53 -1.16998936 54 0.56111225 55 0.81692906 56 0.57753300 57 -0.02529688 58 1.32995129 59 2.61587262 60 2.47296312 61 2.36366862 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1es781257273855.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/freestat/rcomp/tmp/2ty451257273855.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/freestat/rcomp/tmp/3cqqt1257273855.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/freestat/rcomp/tmp/49qkc1257273855.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/freestat/rcomp/tmp/5vb1x1257273855.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/freestat/rcomp/tmp/6ccok1257273855.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/freestat/rcomp/tmp/7edbv1257273855.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/freestat/rcomp/tmp/88di71257273855.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. -14.9400 -8.9200 -6.7450 -7.1770 -5.3250 -0.8509 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9j9xb1257273855.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/freestat/rcomp/tmp/10qo9b1257273855.tab") > > system("convert tmp/1es781257273855.ps tmp/1es781257273855.png") > system("convert tmp/2ty451257273855.ps tmp/2ty451257273855.png") > system("convert tmp/3cqqt1257273855.ps tmp/3cqqt1257273855.png") > system("convert tmp/49qkc1257273855.ps tmp/49qkc1257273855.png") > system("convert tmp/5vb1x1257273855.ps tmp/5vb1x1257273855.png") > system("convert tmp/6ccok1257273855.ps tmp/6ccok1257273855.png") > system("convert tmp/7edbv1257273855.ps tmp/7edbv1257273855.png") > system("convert tmp/88di71257273855.ps tmp/88di71257273855.png") > > > proc.time() user system elapsed 2.584 1.931 3.040