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(4.79,5.95,5.46,5.75,5.15,4.96,5.28,5.73,5.75,5.88,6.3,6.74,6.75,7.34,6.64,6.62,6.32,5.32,5.68,6.18,5.02,2.1,4,3,4.73,5.14,5.81,6.24,4.49,4.22,4.88,5.18,5.19,5.06,4.65,4.83,4.6,4.72,4.33,4.97,5.37,4.19,4.54,5.82,5.49,3.28,5.11,6.24,6.41,6.43,8.42,8.23,3.17,2.72,3,3.47,3.88,3.43,4.06) > x <- c(24710.92,23983.59,24434.12,23939.23,24290.02,24117.63,23724.64,22989.44,23716.86,25058.83,25059.00,23579.18,24209.03,24173.67,24706.39,24522.12,24766.15,25940.04,24985.78,24788.00,26544.56,28019.08,27285.71,29161.16,28357.73,27979.91,27543.95,27397.53,27623.59,27736.07,27803.79,27779.55,27524.13,27582.72,28638.95,28825.78,30132.61,29326.85,29075.62,28230.63,28118.36,28173.29,27396.91,24578.55,24504.77,27582.37,26920.31,25426.68,25390.80,25041.16,22769.42,22921.89,26267.63,27364.67,28382.59,29132.81,28214.51,28865.73,24405.35) > 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 -1.069110747 2 -0.224600155 3 -0.519176561 4 -0.443841916 5 -0.891681921 6 -1.156458458 7 -1.006923284 8 -0.875826413 9 -0.540297967 10 0.171800008 11 0.591873748 12 0.389981437 13 0.673187551 14 1.247849664 15 0.778924303 16 0.678994652 17 0.484846026 18 -0.005963015 19 -0.059886436 20 0.354323765 21 -0.043744137 22 -2.324150774 23 -0.742260114 24 -0.928757841 25 0.452743329 26 0.698858699 27 1.179755043 28 1.546243351 29 -0.105700010 30 -0.326910260 31 0.362464223 32 0.651949789 33 0.551157845 34 0.446572065 35 0.494726378 36 0.755766464 37 1.092621980 38 0.863112479 39 0.364138006 40 0.637611953 41 0.988913294 42 -0.167260062 43 -0.154025582 44 -0.096528058 45 -0.458531150 46 -1.333579753 47 0.209242602 48 0.691360013 49 0.845796569 50 0.714135402 51 1.718736881 52 1.594872844 53 -2.013866339 54 -1.988010127 55 -1.266473304 56 -0.471055044 57 -0.459380319 58 -0.626904673 59 -1.931655944 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1nivo1257795951.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/2xt391257795951.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/3yfgz1257795951.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/4kee91257795951.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/56lvw1257795951.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/6crt71257795951.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/7r5yl1257795951.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/827j21257795951.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. 22770 24510 26540 26300 28000 30130 > > #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/9ztak1257795951.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/109ktt1257795951.tab") > > system("convert tmp/1nivo1257795951.ps tmp/1nivo1257795951.png") > system("convert tmp/2xt391257795951.ps tmp/2xt391257795951.png") > system("convert tmp/3yfgz1257795951.ps tmp/3yfgz1257795951.png") > system("convert tmp/4kee91257795951.ps tmp/4kee91257795951.png") > system("convert tmp/56lvw1257795951.ps tmp/56lvw1257795951.png") > system("convert tmp/6crt71257795951.ps tmp/6crt71257795951.png") > system("convert tmp/7r5yl1257795951.ps tmp/7r5yl1257795951.png") > system("convert tmp/827j21257795951.ps tmp/827j21257795951.png") > > > proc.time() user system elapsed 2.562 1.900 3.118