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(100.00,98.86,96.87,103.18,104.66,103.74,103.87,98.10,98.91,109.43,104.89,88.63,97.03,93.79,97.61,98.17,96.31,97.82,87.52,85.71,89.15,90.65,92.74,80.00,84.33,93.26,115.89,105.21,94.23,106.12,94.41,101.30,98.43,107.94,102.82,92.33,97.48,88.37,92.50,81.48,92.55,98.96,77.28,91.01,81.21,88.41,96.02,91.59,86.30,86.37,105.41,76.73,93.26,95.02,84.32,93.24,89.81,111.66,103.23,103.21) > x <- c(100.00,127.27,109.09,136.36,100.00,118.18,136.36,100.00,127.27,118.18,136.36,145.45,154.55,100.00,145.45,118.18,154.55,145.45,154.55,172.73,163.64,172.73,145.45,136.36,145.45,145.45,154.55,181.82,181.82,172.73,154.55,163.64,172.73,154.55,181.82,190.91,218.18,227.27,227.27,236.36,200.00,227.27,254.55,254.55,263.64,272.73,281.82,263.64,245.45,200.00,227.27,209.09,236.36,209.09,200.00,163.64,163.64,181.82,145.45,163.64) > 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.85363858 2 0.02167554 3 -3.31186721 4 5.01344692 5 3.80636142 6 4.22990417 7 5.70344692 8 -2.75363858 9 0.07167554 10 9.91990417 11 6.72344692 12 -8.86478171 13 0.20772869 14 -7.06363858 15 0.11521829 16 -1.34009583 17 -0.51227131 18 0.32521829 19 -9.30227131 20 -9.76872857 21 -7.00049994 22 -4.82872857 23 -4.75478171 24 -18.16655308 25 -13.16478171 26 -4.23478171 27 19.06772869 28 10.40304281 29 -0.57695719 30 10.64127143 31 -2.41227131 32 5.14950006 33 2.95127143 34 11.11772869 35 8.01304281 36 -1.80518582 37 5.36012831 38 -3.07810032 39 1.05189968 40 -9.29632895 41 -0.91341444 42 7.51189968 43 -12.15204718 44 1.57795282 45 -7.55027580 46 0.32149557 47 8.60326695 48 2.82972420 49 -3.80455757 50 -7.09341444 51 13.96189968 52 -16.06164307 53 2.48367105 54 2.22835693 55 -9.14341444 56 -2.91049994 57 -6.34049994 58 16.85304281 59 5.73521829 60 7.05950006 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1tode1257950143.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/2rk181257950143.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/3hhwt1257950143.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/4vpwk1257950143.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/518fl1257950143.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/6yl6i1257950143.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/7vo9g1257950143.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/87dms1257950143.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. 100.0 145.4 163.6 174.8 209.1 281.8 > > #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/9bgpc1257950143.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/104rne1257950143.tab") > > system("convert tmp/1tode1257950143.ps tmp/1tode1257950143.png") > system("convert tmp/2rk181257950143.ps tmp/2rk181257950143.png") > system("convert tmp/3hhwt1257950143.ps tmp/3hhwt1257950143.png") > system("convert tmp/4vpwk1257950143.ps tmp/4vpwk1257950143.png") > system("convert tmp/518fl1257950143.ps tmp/518fl1257950143.png") > system("convert tmp/6yl6i1257950143.ps tmp/6yl6i1257950143.png") > system("convert tmp/7vo9g1257950143.ps tmp/7vo9g1257950143.png") > system("convert tmp/87dms1257950143.ps tmp/87dms1257950143.png") > > > proc.time() user system elapsed 2.562 1.892 3.056