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(85.9,76.8,96.2,83.9,88.7,105.4,86.7,76.3,93.2,105.1,121,107.85,94.7,78.4,101.4,91.2,89.9,112.2,81.5,78.8,99.1,101.3,91.5,89.05,86.6,86.6,98.5,86.7,89.1,111,92.6,85.1,116.1,98.3,97.7,95.95,94.2,83.8,109.5,102.3,102.5,93.9,85.3,88.2,104.7,99.4,113.8,101.5,89.2,93.2,115,97.2,112.5,121.8,100.2,93.8,113.6,110.7,127.6,116.75) > x <- c(2.6,2.5,2.5,1.6,1.4,0.8,1.1,1.3,1.2,1.3,1.1,1.3,1.2,1.6,1.7,1.5,0.9,1.5,1.4,1.6,1.7,1.4,1.8,1.7,1.4,1.2,1,1.7,2.4,2,2.1,2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1) > 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 -12.8017185 2 -21.7160707 3 -2.3160707 4 -12.9452404 5 -7.7739448 6 10.0399420 7 -9.2170014 8 -19.9882970 9 -2.9026492 10 8.8117030 11 25.0829986 12 11.5617030 13 -1.4026492 14 -18.4452404 15 4.3691118 16 -5.4595926 17 -5.6457058 18 15.5404074 19 -14.9739448 20 -18.0452404 21 2.0691118 22 4.8260552 23 -5.7165360 24 -7.9808882 25 -9.8739448 26 -9.5026492 27 2.7686464 28 -10.3308882 29 -9.2304229 30 13.4121683 31 -5.1734795 32 -12.4878317 33 18.8834640 34 -0.5873663 35 -0.4447751 36 -1.4521839 37 -3.3878317 38 -14.3447751 39 10.4269859 40 3.9695771 41 4.3552249 42 -4.9873663 43 -13.5873663 44 -11.0586619 45 5.2556903 46 1.4408727 47 15.6552249 48 2.4269859 49 -9.8730141 50 -5.8730141 51 17.0408727 52 -1.5017185 53 13.4269859 54 23.2839293 55 1.8695771 56 -4.3447751 57 16.1978161 58 13.6691118 59 30.0121683 60 18.9765205 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15rr01257332662.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/2ox2p1257332662.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/3m3551257332662.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/4b3re1257332662.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/501jp1257332662.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/6iqmb1257332662.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/710og1257332662.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/8qex01257332662.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. 0.800 1.475 2.000 1.962 2.425 3.000 > > #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/9tgoq1257332662.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/10f1701257332662.tab") > > system("convert tmp/15rr01257332662.ps tmp/15rr01257332662.png") > system("convert tmp/2ox2p1257332662.ps tmp/2ox2p1257332662.png") > system("convert tmp/3m3551257332662.ps tmp/3m3551257332662.png") > system("convert tmp/4b3re1257332662.ps tmp/4b3re1257332662.png") > system("convert tmp/501jp1257332662.ps tmp/501jp1257332662.png") > system("convert tmp/6iqmb1257332662.ps tmp/6iqmb1257332662.png") > system("convert tmp/710og1257332662.ps tmp/710og1257332662.png") > system("convert tmp/8qex01257332662.ps tmp/8qex01257332662.png") > > > proc.time() user system elapsed 1.584 1.148 2.112