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(8.44,6.48,6.19,7.88,7.51,7.78,7.47,8.36,8.43,9.56,8.93,9.42,9.68,8.49,8.76,8.30,7.74,8.21,6.20,6.35,6.76,6.78,6.13,6.85,7.39,6.52,6.79,7.18,6.79,7.10,6.48,7.32,6.77,7.14,6.32,6.73,7.47,7.11,6.55,6.23,7.39,7.77,6.68,6.96,7.76,7.69,7.91,7.72,7.73,8.08,9.94,12.13,14.58,13.61,13.87,14.61,13.69,13.97,14.39,13.82,16.42) > x <- c(7.40,5.61,5.99,7.21,6.99,8.15,8.40,8.26,8.71,8.63,8.98,9.21,9.66,8.08,7.98,8.05,7.69,8.63,6.68,6.24,5.80,6.11,6.70,6.82,6.75,6.49,7.41,6.42,6.86,7.09,6.99,5.71,5.62,6.57,6.38,6.28,6.52,6.00,5.95,5.53,6.17,6.91,7.07,6.57,6.27,6.02,6.24,6.43,6.61,8.47,9.29,11.12,12.89,11.98,12.59,12.69,13.06,12.76,12.60,13.24,15.73) > 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.517886129 2 0.451950746 3 -0.240141184 4 0.158932094 5 0.021722159 6 -0.935716364 7 -1.510250529 8 -0.472111397 9 -0.878272893 10 0.336378040 11 -0.663969790 12 -0.417341222 13 -0.633502718 14 -0.151646798 15 0.224166867 16 -0.309902699 17 -0.488973502 18 -1.013621960 19 -0.960255477 20 -0.344675348 21 0.530904781 22 0.222882417 23 -1.051418211 24 -0.458394610 25 0.155674956 26 -0.439209513 27 -1.142695238 28 0.294860054 29 -0.560720076 30 -0.494091507 31 -1.008277841 32 1.186137081 33 0.731369380 34 0.096139555 35 -0.522814480 36 -0.007000814 37 0.479046388 38 0.669277450 39 0.162184283 40 0.286601679 41 0.769394218 42 0.366373091 43 -0.892928774 44 -0.083860445 45 1.033580552 46 1.228114717 47 1.215324652 48 0.824278687 49 0.643814089 50 -0.974320095 51 0.018007846 52 0.271617762 53 0.848715878 54 0.841620236 55 0.456156875 56 1.090343209 57 -0.221167354 58 0.376273643 59 0.965575508 60 -0.281631952 61 -0.316392230 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1s6jn1257352128.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/2t6hm1257352128.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/3agwm1257352128.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/44zwm1257352128.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/58hh11257352128.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/66yqz1257352128.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/7hsmw1257352128.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/80fjz1257352128.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. 5.530 6.380 6.990 8.021 8.630 15.730 > > #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/93juj1257352128.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/100wwq1257352128.tab") > > system("convert tmp/1s6jn1257352128.ps tmp/1s6jn1257352128.png") > system("convert tmp/2t6hm1257352128.ps tmp/2t6hm1257352128.png") > system("convert tmp/3agwm1257352128.ps tmp/3agwm1257352128.png") > system("convert tmp/44zwm1257352128.ps tmp/44zwm1257352128.png") > system("convert tmp/58hh11257352128.ps tmp/58hh11257352128.png") > system("convert tmp/66yqz1257352128.ps tmp/66yqz1257352128.png") > system("convert tmp/7hsmw1257352128.ps tmp/7hsmw1257352128.png") > system("convert tmp/80fjz1257352128.ps tmp/80fjz1257352128.png") > > > proc.time() user system elapsed 1.660 1.202 2.196