R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(-478.349,-478.7143,-478.4909,-478.4344,-478.233,-478.2786,-478.4745,-478.7409,-478.8389,-479.176,-478.6092,-478.6974,-478.7695,-478.8283,-478.7667,-478.6774,-478.7197,-478.0234,-477.9766,-477.6735,-478.0569,-478.3449,-478.8246,-479.1665,-479.2505,-479.21,-478.7559,-478.7917,-478.6561,-478.6001,-478.768,-478.6868,-478.7203,-479.3989,-479.1421,-479.1657,-479.3069,-479.6387,-479.3888,-479.0944,-478.9708,-478.9827,-479.1875,-479.5226,-479.4951,-479.6688,-478.8378,-478.7608,-479.3051,-479.5951,-479.5537,-479.258,-478.3362,-477.9866,-477.8301,-477.9153,-478.1153,-478.3757) > x <- c(1.655,0.3865,0.4795,0.272,0.675,0.563,0.3575,0.0295,-0.2805,-0.16,1.126,1.037,0.7825,0.1565,0.0885,-0.163,-0.6965,0.467,0.253,0.8025,0.3095,0.3495,0.393,0.4175,0.1375,0.01,0.5545,0.4635,0.5255,0.6455,0.4,0.374,0.2165,-0.8805,-0.7445,-0.5665,-0.5405,-0.9515,-0.316,-0.228,-0.606,-0.8315,-0.9275,-1.417,-1.2295,-1.616,-0.521,-0.256,-0.9795,-0.7295,-0.4265,-0.35,0.311,0.203,-0.3045,-0.5585,-0.9585,-1.5165) > 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.214729384 2 -0.107686844 3 0.081083392 4 0.214848727 5 0.266186414 6 0.262291077 7 0.142911685 8 -0.001353232 9 0.016079317 10 -0.365890432 11 -0.277949326 12 -0.333009013 13 -0.310342615 14 -0.136043340 15 -0.049122652 16 0.133826657 17 0.290182349 18 0.553237930 19 0.679723625 20 0.778210124 21 0.578385112 22 0.275490590 23 -0.220407203 24 -0.571430098 25 -0.551168442 26 -0.463192152 27 -0.211843837 28 -0.213758799 29 -0.101245309 30 -0.089928876 31 -0.166413745 32 -0.075532305 33 -0.050385124 34 -0.320502848 35 -0.114344224 36 -0.204224848 37 -0.355106288 38 -0.533865071 39 -0.520601795 40 -0.258969744 41 0.005383492 42 0.077451362 43 -0.091601784 44 -0.244430067 45 -0.286748140 46 -0.316529818 47 0.106732632 48 0.085056422 49 -0.189838905 50 -0.572929670 51 -0.644355677 52 -0.377141451 53 0.298526567 54 0.688341778 55 1.033816030 56 1.043196247 57 0.992141471 58 0.939520057 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1pc4k1257332855.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/rcomp/tmp/2f2k31257332855.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/rcomp/tmp/3gmea1257332855.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/rcomp/tmp/47igv1257332855.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/rcomp/tmp/5h0gy1257332855.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/rcomp/tmp/6szch1257332855.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/rcomp/tmp/7xanc1257332855.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/rcomp/tmp/8uxwy1257332855.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.61600 -0.56450 0.05900 -0.07438 0.39830 1.65500 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/9wizy1257332855.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/rcomp/tmp/10w2ax1257332855.tab") > > system("convert tmp/1pc4k1257332855.ps tmp/1pc4k1257332855.png") > system("convert tmp/2f2k31257332855.ps tmp/2f2k31257332855.png") > system("convert tmp/3gmea1257332855.ps tmp/3gmea1257332855.png") > system("convert tmp/47igv1257332855.ps tmp/47igv1257332855.png") > system("convert tmp/5h0gy1257332855.ps tmp/5h0gy1257332855.png") > system("convert tmp/6szch1257332855.ps tmp/6szch1257332855.png") > system("convert tmp/7xanc1257332855.ps tmp/7xanc1257332855.png") > system("convert tmp/8uxwy1257332855.ps tmp/8uxwy1257332855.png") > > > proc.time() user system elapsed 1.606 1.156 2.175