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(23.2,23.2,20.9,20.9,20.9,19.8,19.8,19.8,20.6,20.6,20.6,21.1,21.1,21.1,22.4,22.4,22.4,20.5,20.5,20.5,18.4,18.4,18.4,17.6,17.6,17.6,18.5,18.5,18.5,17.3,17.3,17.3,16.2,16.2,16.2,18.5,18.5,18.5,16.3,16.3,16.3,16.8,16.8,16.8,14.8,14.8,14.8,21.4,21.4,21.4,16.1,16.1,16.1,19.6,19.6,19.6,18.9,18.9,18.9,18.9,18.9) > x <- c(9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3) > 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.86021905 2 0.86021905 3 0.01332309 4 1.22424313 5 0.98205912 6 -0.60230890 7 -0.84449290 8 -0.60230890 9 0.92424313 10 1.16642713 11 1.65079515 12 0.45550710 13 0.21332309 14 0.21332309 15 1.99769110 16 2.23987511 17 1.99769110 18 -0.38667691 19 -0.38667691 20 -0.14449290 21 -2.00230890 22 -1.51794088 23 -0.79138886 24 -2.07575687 25 -1.83357287 26 -1.83357287 27 -0.69138886 28 -0.44920485 29 -0.44920485 30 -1.89138886 31 -1.89138886 32 -1.64920485 33 -2.99138886 34 -2.26483684 35 -1.05391681 36 0.51953117 37 1.00389919 38 1.73045121 39 -0.46954879 40 -0.46954879 41 -0.95391681 42 -0.69610081 43 -0.21173280 44 0.51481922 45 -0.51644475 46 0.21010727 47 -0.75862876 48 2.93516316 49 2.45079515 50 3.41953117 51 -0.42736479 52 0.29918723 53 -0.42736479 54 1.13516316 55 0.40861114 56 0.40861114 57 0.43516316 58 1.40389919 59 1.16171518 60 -0.53357287 61 -1.01794088 > library(lattice) > postscript(file="/var/www/rcomp/tmp/14bno1257355399.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/20aa51257355399.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/3zmb41257355399.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/4asox1257355399.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/5uoxu1257355399.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/6i3ad1257355399.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/7jrwz1257355399.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/85czg1257355399.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. 6.100 7.300 8.000 7.869 8.400 9.300 > > #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/9ed8t1257355399.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/10wnap1257355399.tab") > > system("convert tmp/14bno1257355399.ps tmp/14bno1257355399.png") > system("convert tmp/20aa51257355399.ps tmp/20aa51257355399.png") > system("convert tmp/3zmb41257355399.ps tmp/3zmb41257355399.png") > system("convert tmp/4asox1257355399.ps tmp/4asox1257355399.png") > system("convert tmp/5uoxu1257355399.ps tmp/5uoxu1257355399.png") > system("convert tmp/6i3ad1257355399.ps tmp/6i3ad1257355399.png") > system("convert tmp/7jrwz1257355399.ps tmp/7jrwz1257355399.png") > system("convert tmp/85czg1257355399.ps tmp/85czg1257355399.png") > > > proc.time() user system elapsed 1.990 1.790 3.518