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(416.25,398.35,400.00,427.25,391.25,397.20,394.80,391.50,407.65,418.10,429.10,452.85,427.75,420.90,433.45,427.15,427.90,415.35,432.60,431.65,439.60,466.10,459.50,499.75,530.00,568.25,564.25,587.00,661.00,625.00,622.95,637.25,621.05,600.60,614.10,648.75,639.75,660.20,670.40,658.25,673.60,666.50,654.75,665.75,672.00,742.50,790.25,784.25,846.75,914.75,988.50,887.75,853.00,888.25,937.50,912.50,822.25,880.00,729.50,778.00) > x <- c(5.9650,6.2050,6.7300,7.9400,6.1000,6.1700,5.8750,6.6400,6.7300,6.8400,7.2400,7.7150,6.3900,6.7000,7.2600,7.1050,6.8500,7.3800,7.0200,7.2500,6.8550,7.3700,7.5350,8.3150,9.0400,9.7700,9.8000,11.5850,13.9200,12.0500,11.2800,11.3550,12.7500,11.5800,12.3600,13.8500,13.0100,13.5800,14.2900,13.3350,13.4500,13.5300,12.4700,12.7700,12.1000,13.7750,14.3600,13.8600,14.9300,17.1900,20.1600,16.7400,16.6400,16.8600,17.5600,17.5900,13.5800,12.2800,10.0500,9.9100) > 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 26.0964991 2 -2.3320484 3 -23.7132460 4 -49.5446729 5 -4.8258089 6 -1.9466352 7 8.5947044 8 -28.2650407 9 -16.0632460 10 -10.4388302 11 -16.9864094 12 -14.0741596 13 18.9521963 14 -1.4971776 15 -13.5137883 16 -13.0141014 17 -1.0775197 18 -36.8780621 19 -3.8352409 20 -14.8750989 21 10.4031355 22 14.3106274 23 0.4722510 24 6.5044717 25 4.9494845 26 11.1751526 27 5.8590842 28 -49.6969877 29 -78.1309809 30 -32.0960485 31 -0.3669586 32 10.6428703 33 -66.7543119 34 -35.8776430 35 -56.5954223 36 -87.3101546 37 -59.4602384 38 -64.0155387 39 -84.9624916 40 -55.2176464 41 -44.9125754 42 -55.5220913 43 -20.7710066 44 -22.9316909 45 12.7105041 46 9.7300165 47 31.8166820 48 47.7511560 49 63.3113818 50 32.1675597 51 -24.3732154 52 24.9085862 53 -5.4545190 54 20.1443125 55 38.6860490 56 12.3699805 57 98.0344613 58 212.8140935 59 160.1418472 60 214.7834999 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/152ih1257171451.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/26t9c1257171451.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/3iyml1257171451.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/4xe7p1257171451.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/5sz661257171451.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/6b56f1257171451.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/7r8eg1257171451.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/81b571257171451.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. 5.875 7.206 11.320 10.830 13.580 20.160 > > #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/9j6451257171451.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/10lq4w1257171451.tab") > > system("convert tmp/152ih1257171451.ps tmp/152ih1257171451.png") > system("convert tmp/26t9c1257171451.ps tmp/26t9c1257171451.png") > system("convert tmp/3iyml1257171451.ps tmp/3iyml1257171451.png") > system("convert tmp/4xe7p1257171451.ps tmp/4xe7p1257171451.png") > system("convert tmp/5sz661257171451.ps tmp/5sz661257171451.png") > system("convert tmp/6b56f1257171451.ps tmp/6b56f1257171451.png") > system("convert tmp/7r8eg1257171451.ps tmp/7r8eg1257171451.png") > system("convert tmp/81b571257171451.ps tmp/81b571257171451.png") > > > proc.time() user system elapsed 2.575 1.933 3.077