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(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(3.75,3.75,3.55,3.5,3.5,3.1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3.21,3.25,3.25,3.45,3.5,3.5,3.64,3.75,3.93,4,4.17,4.25,4.39,4.5,4.5,4.65,4.75,4.75,4.9,5,5,5,5,5,5,5,5,5,5,5,5,5.18,5.25,5.25,4.49,3.92,3.25) > 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.03798062 2 -0.03798062 3 -0.03739093 4 -0.03724351 5 -0.03724351 6 -0.03606413 7 -0.03576929 8 -0.03576929 9 -0.03576929 10 -0.03576929 11 -0.03576929 12 -0.03576929 13 -0.03576929 14 -0.03576929 15 -0.03576929 16 -0.03576929 17 -0.03576929 18 -0.03576929 19 -0.03576929 20 -0.03576929 21 -0.03576929 22 -0.03576929 23 -0.03576929 24 -0.03576929 25 -0.03576929 26 -0.03576929 27 -0.03576929 28 -0.03576929 29 -0.03576929 30 -0.03576929 31 -0.03576929 32 -0.03576929 33 -0.03576929 34 -0.03576929 35 -0.03576929 36 -0.03638846 37 -0.03650640 38 -0.03650640 39 -0.03709609 40 -0.03724351 41 -0.03724351 42 -0.03765629 43 -0.03798062 44 -0.03851133 45 -0.03871772 46 -0.03921896 47 -0.03945483 48 -0.03986761 49 -0.04019194 50 -0.04019194 51 -0.04063421 52 -0.04092905 53 -0.04092905 54 -0.04137132 55 -0.04166616 56 -0.04166616 57 -0.04166616 58 -0.04166616 59 -0.04166616 60 -0.04166616 61 -0.04166616 62 -0.04166616 63 -0.04166616 64 -0.04166616 65 -0.04166616 66 -0.04166616 67 -0.04219688 68 -0.04240327 69 -0.04240327 70 0.69983754 71 0.96151815 72 0.96349360 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1tar01257761328.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/2f0b61257761328.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/3w78z1257761328.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/4j8lg1257761328.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/5rzcb1257761328.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/6g36x1257761328.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/7cxmf1257761328.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/8kmfb1257761328.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. 3.000 3.000 3.500 3.775 4.675 5.250 > > #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/9q8fq1257761328.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/103gor1257761328.tab") > > system("convert tmp/1tar01257761328.ps tmp/1tar01257761328.png") > system("convert tmp/2f0b61257761328.ps tmp/2f0b61257761328.png") > system("convert tmp/3w78z1257761328.ps tmp/3w78z1257761328.png") > system("convert tmp/4j8lg1257761328.ps tmp/4j8lg1257761328.png") > system("convert tmp/5rzcb1257761328.ps tmp/5rzcb1257761328.png") > system("convert tmp/6g36x1257761328.ps tmp/6g36x1257761328.png") > system("convert tmp/7cxmf1257761328.ps tmp/7cxmf1257761328.png") > system("convert tmp/8kmfb1257761328.ps tmp/8kmfb1257761328.png") > > > proc.time() user system elapsed 2.110 1.770 3.625