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(1.75,1.75,1.55,1.5,1.5,1.1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.21,1.25,1.25,1.45,1.5,1.5,1.64,1.75,1.93,2,2.17,2.25,2.39,2.5,2.5,2.65,2.75,2.75,2.9,3,3,3,3,3,3,3,3,3,3,3,3,3.18,3.25,3.25,3.23,2.92,2.25) > x <- c(2.93,2.76,2.51,2.51,2.48,2.24,2.12,2.1,2.13,2.12,2.14,2.13,2.13,2.04,2.02,1.92,2.03,2.05,2.08,2.08,2.08,2.08,2.12,2.14,2.13,2.1,2.09,2.1,2.09,2.08,2.07,2.08,2.09,2.11,2.2,2.42,2.46,2.5,2.59,2.75,2.78,2.9,3.03,3.1,3.23,3.36,3.51,3.61,3.67,3.74,3.82,3.89,3.98,4.08,4.14,4.33,4.57,4.63,4.57,4.71,4.54,4.3,4.36,4.61,4.71,4.68,4.91,4.75,4.77,5.18,3.42,2.71) > 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.010295349 2 0.150717601 3 0.157220912 4 0.107220912 5 0.132001309 6 -0.069755513 7 -0.070633924 8 -0.054113659 9 -0.078894056 10 -0.070633924 11 -0.087154188 12 -0.078894056 13 -0.078894056 14 -0.004552864 15 0.011967401 16 0.094568725 17 0.003707268 18 -0.012812997 19 -0.037593394 20 -0.037593394 21 -0.037593394 22 -0.037593394 23 -0.070633924 24 -0.087154188 25 -0.078894056 26 -0.054113659 27 -0.045853526 28 -0.054113659 29 -0.045853526 30 -0.037593394 31 -0.029333261 32 -0.037593394 33 -0.045853526 34 -0.062373791 35 -0.136714983 36 -0.108437897 37 -0.101478426 38 -0.134518956 39 -0.008860148 40 -0.091022267 41 -0.115802664 42 -0.074924253 43 -0.072305975 44 0.049873098 45 0.012491376 46 0.075109655 47 0.031207668 48 0.088606344 49 0.149045549 50 0.091224622 51 0.175143563 52 0.217322636 53 0.142981444 54 0.210380120 55 0.260819325 56 0.103876809 57 -0.094366370 58 -0.143927164 59 -0.094366370 60 -0.210008224 61 -0.069585972 62 0.128657206 63 0.079096412 64 -0.127406899 65 -0.210008224 66 -0.185227826 67 -0.195210872 68 0.006951247 69 -0.009569018 70 -0.368234448 71 0.775548860 72 0.692018263 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1pcuo1257761180.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/2y3921257761180.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/3dt361257761180.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/4dw581257761180.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/55txd1257761180.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/62k5g1257761180.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/7nfje1257761180.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/82b781257761180.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.920 2.108 2.550 3.019 3.912 5.180 > > #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/9ixvn1257761180.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/104b411257761180.tab") > > system("convert tmp/1pcuo1257761180.ps tmp/1pcuo1257761180.png") > system("convert tmp/2y3921257761180.ps tmp/2y3921257761180.png") > system("convert tmp/3dt361257761180.ps tmp/3dt361257761180.png") > system("convert tmp/4dw581257761180.ps tmp/4dw581257761180.png") > system("convert tmp/55txd1257761180.ps tmp/55txd1257761180.png") > system("convert tmp/62k5g1257761180.ps tmp/62k5g1257761180.png") > system("convert tmp/7nfje1257761180.ps tmp/7nfje1257761180.png") > system("convert tmp/82b781257761180.ps tmp/82b781257761180.png") > > > proc.time() user system elapsed 2.614 1.942 3.228