R version 2.8.0 (2008-10-20) 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(65.35,58.6,55.4,55.7,54.1,54.4,55.1,54.75,54.75,58,55.6,56.05,57,59.55,57.05,57.55,57.7,55.4,58,59.6,63.25,63.9,65.65,70.15,68.65,71.5,67.25,69.95,79.65,85.2,87.5,87.9,90.45,90.15,84.8,86.15,92.4,88.85,92.3,105.7,107.65,107.95,122.35,129.65,144.5,155.45,160.5,157.55,166.6,157.05,142.35,136.95,108,98.2,95.45,103.2,98.15,99.75,99.45,107.2) > x <- c(1.1,1.15,1.1,1,1.45,1.25,1.05,1.1,1.25,1.5,1.3,1.25,1.45,1.45,1.55,1.6,1.2,1.25,1.5,1.5,1.5,1.2,1.4,1.5,1.35,1.3,1.25,1.05,0.95,1.1,1.15,0.95,1,1,1,0.75,0.75,0.75,0.7,0.8,1.2,1.55,1.65,1.85,1.9,2.3,2.15,2.65,3,3.05,2.8,2.85,2.5,1.7,1.45,1.15,1.05,0.4,0.45,0) > 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 -13.544853 2 -21.801458 3 -23.494853 4 -20.181644 5 -35.341086 6 -29.014667 7 -22.288248 8 -24.144853 9 -28.664667 10 -32.947691 11 -29.321272 12 -27.364667 13 -32.441086 14 -29.891086 15 -35.404296 16 -36.410900 17 -24.208063 18 -28.014667 19 -32.947691 20 -31.347691 21 -27.697691 22 -18.008063 23 -22.284481 24 -20.797691 25 -17.777877 26 -13.421272 27 -16.164667 28 -7.438248 29 5.274961 30 6.305147 31 7.098542 32 13.524961 33 14.568356 34 14.268356 35 8.918356 36 17.801380 37 24.051380 38 20.501380 39 25.457985 40 35.844775 41 25.741937 42 15.495704 43 26.882495 44 28.156076 45 41.499471 46 40.396634 47 49.966448 48 31.950401 49 30.454168 50 19.397563 51 12.230587 52 5.323982 53 -13.079785 54 1.225890 55 6.008914 56 22.798542 57 20.761752 58 41.947613 59 40.141008 60 61.450450 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1kf191256384093.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/freestat/rcomp/tmp/201551256384093.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/freestat/rcomp/tmp/3n8l91256384093.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/freestat/rcomp/tmp/41jzs1256384093.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/freestat/rcomp/tmp/5e8u61256384093.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/freestat/rcomp/tmp/6jzkd1256384093.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/freestat/rcomp/tmp/7wxdp1256384093.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/freestat/rcomp/tmp/8f50z1256384093.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.000 1.050 1.250 1.385 1.512 3.050 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/92ld61256384093.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/freestat/rcomp/tmp/10afdg1256384093.tab") > > system("convert tmp/1kf191256384093.ps tmp/1kf191256384093.png") > system("convert tmp/201551256384093.ps tmp/201551256384093.png") > system("convert tmp/3n8l91256384093.ps tmp/3n8l91256384093.png") > system("convert tmp/41jzs1256384093.ps tmp/41jzs1256384093.png") > system("convert tmp/5e8u61256384093.ps tmp/5e8u61256384093.png") > system("convert tmp/6jzkd1256384093.ps tmp/6jzkd1256384093.png") > system("convert tmp/7wxdp1256384093.ps tmp/7wxdp1256384093.png") > system("convert tmp/8f50z1256384093.ps tmp/8f50z1256384093.png") > > > proc.time() user system elapsed 2.631 1.974 3.060