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(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) > x <- 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) > 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.034947641 2 0.034947641 3 0.025154648 4 0.022706400 5 0.022706400 6 0.003120415 7 -0.001776081 8 -0.001776081 9 -0.001776081 10 -0.001776081 11 -0.001776081 12 -0.001776081 13 -0.001776081 14 -0.001776081 15 -0.001776081 16 -0.001776081 17 -0.001776081 18 -0.001776081 19 -0.001776081 20 -0.001776081 21 -0.001776081 22 -0.001776081 23 -0.001776081 24 -0.001776081 25 -0.001776081 26 -0.001776081 27 -0.001776081 28 -0.001776081 29 -0.001776081 30 -0.001776081 31 -0.001776081 32 -0.001776081 33 -0.001776081 34 -0.001776081 35 -0.001776081 36 0.008506561 37 0.010465160 38 0.010465160 39 0.020258152 40 0.022706400 41 0.022706400 42 0.029561495 43 0.034947641 44 0.043761334 45 0.047188881 46 0.055512925 47 0.059430122 48 0.066285216 49 0.071671362 50 0.071671362 51 0.079016106 52 0.083912603 53 0.083912603 54 0.091257347 55 0.096153843 56 0.096153843 57 0.096153843 58 0.096153843 59 0.096153843 60 0.096153843 61 0.096153843 62 0.096153843 63 0.096153843 64 0.096153843 65 0.096153843 66 0.096153843 67 0.104967536 68 0.108395084 69 0.108395084 70 -0.632584216 71 -0.907763354 72 -0.940569878 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1i0gy1257760013.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/2l7o91257760013.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/3yie81257760013.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/49dyq1257760013.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/5gro71257760013.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/6eaqk1257760013.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/772bb1257760013.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/81iai1257760013.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.000 1.000 1.500 1.813 2.788 3.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/9ccpu1257760014.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/10pro51257760014.tab") > > system("convert tmp/1i0gy1257760013.ps tmp/1i0gy1257760013.png") > system("convert tmp/2l7o91257760013.ps tmp/2l7o91257760013.png") > system("convert tmp/3yie81257760013.ps tmp/3yie81257760013.png") > system("convert tmp/49dyq1257760013.ps tmp/49dyq1257760013.png") > system("convert tmp/5gro71257760013.ps tmp/5gro71257760013.png") > system("convert tmp/6eaqk1257760013.ps tmp/6eaqk1257760013.png") > system("convert tmp/772bb1257760013.ps tmp/772bb1257760013.png") > system("convert tmp/81iai1257760013.ps tmp/81iai1257760013.png") > > > proc.time() user system elapsed 1.730 1.620 3.524