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(18.0,19.6,23.3,23.7,20.3,22.8,24.3,21.5,23.5,22.2,20.9,22.2,19.5,21.1,22.0,19.2,17.8,19.2,19.9,19.6,18.1,20.4,18.1,18.6,17.6,19.4,19.3,18.6,16.9,16.4,19.0,18.7,17.1,21.5,17.8,18.1,19.0,18.9,16.8,18.1,15.7,15.1,18.3,16.5,16.9,18.4,16.4,15.7,16.9,16.6,16.7,16.6,14.4,14.5,17.5,14.3,15.4,17.2,14.6,14.2,14.9,14.1,15.6,14.6,11.9,13.5,14.2,13.7,14.4,15.3,14.3,14.5) > x <- c(94.3,99.4,115.7,116.8,99.8,96.0,115.9,109.1,117.3,109.8,112.8,110.7,100.0,113.3,122.4,112.5,104.2,92.5,117.2,109.3,106.1,118.8,105.3,106.0,102.0,112.9,116.5,114.8,100.5,85.4,86.6,109.9,100.7,115.5,100.7,99.0,102.3,108.8,105.9,113.2,95.7,80.9,113.9,98.1,102.8,104.7,95.9,94.6,101.6,103.9,110.3,114.1,96.8,87.4,111.4,97.4,102.9,112.7,97.0,95.1,96.9,98.6,111.7,109.8,89.9,87.4,104.5,98.1,102.7,105.4,97.0,97.4) > 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 2.03886013 2 2.68149779 3 3.32169265 4 3.51520274 5 3.30641055 6 6.51973935 7 4.28414903 8 2.76063216 9 3.22134368 10 3.32922948 11 1.46607516 12 3.16028319 13 2.46886692 14 1.57221611 15 0.76398134 16 -0.17760941 17 -0.01954912 18 3.57675272 19 -0.35988450 20 0.82308854 21 -0.07621352 22 -0.16023347 23 0.07396096 24 0.44255829 25 0.19343071 26 -0.05269665 27 -0.82848183 28 -1.20936105 29 -0.22499213 30 2.10955128 31 4.48428955 32 -0.18954233 33 -0.06253575 34 1.55923628 35 0.63746425 36 1.25658503 37 1.53711528 38 0.21694759 39 -1.33866990 40 -1.40901208 41 -0.52394522 42 1.65428275 43 -1.34041475 44 -0.17446867 45 -0.65674377 46 0.48659182 47 0.13851116 48 -0.31745530 49 -0.43148205 50 -1.16323369 51 -2.26462957 52 -3.07795838 53 -2.03043514 54 -0.16588494 55 -1.67111949 56 -2.24306600 57 -2.17551558 58 -2.21515303 59 -1.86797876 60 -1.91131436 61 -1.54920695 62 -2.66832773 63 -3.62743492 64 -4.27077052 65 -3.23518020 66 -1.16588494 67 -3.67586455 68 -2.97446867 69 -3.13797196 70 -2.74481085 71 -2.16797876 72 -2.04306600 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/11qc81257353468.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/2a7151257353468.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/30ont1257353468.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/4q6e31257353468.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/5ooh61257353468.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/6zu3d1257353468.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/7oibj1257353468.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/8feh81257353468.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. 80.9 97.4 104.0 104.1 111.9 122.4 > > #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/9paw81257353468.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/10b5zn1257353468.tab") > > system("convert tmp/11qc81257353468.ps tmp/11qc81257353468.png") > system("convert tmp/2a7151257353468.ps tmp/2a7151257353468.png") > system("convert tmp/30ont1257353468.ps tmp/30ont1257353468.png") > system("convert tmp/4q6e31257353468.ps tmp/4q6e31257353468.png") > system("convert tmp/5ooh61257353468.ps tmp/5ooh61257353468.png") > system("convert tmp/6zu3d1257353468.ps tmp/6zu3d1257353468.png") > system("convert tmp/7oibj1257353468.ps tmp/7oibj1257353468.png") > system("convert tmp/8feh81257353468.ps tmp/8feh81257353468.png") > > > proc.time() user system elapsed 1.638 1.191 4.840