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(30913600,15382084,14130081,17123044,21473956,15968016,18558864,17164449,19616041,27237961,24295041,33120025,31270464,17330569,24621444,27123264,22610025,20169081,32855824,32844361,25401600,37234404,24049216,28826161,31114084,21335161,22382361,25110121,28079401,17189316,21390625,22429696,17799961,26173456,17682025,16982641,26040609,18490000,20958084,14508481,30536676,18037009,14668900,19307236,23290276,19439281,20875761,16859236,22982436,15319396,14386849,19404025,16176484,16810000,22924944,10004569,12852225,15233409,17455684,14922769,17530969) > x <- c(64,65.61,59.29,56.25,57.76,60.84,60.84,60.84,56.25,56.25,50.41,56.25,56.25,57.76,59.29,59.29,62.41,65.61,67.24,67.24,67.24,62.41,53.29,47.61,44.89,44.89,47.61,49,50.41,51.84,50.41,47.61,49,46.24,40.96,44.89,43.56,40.96,39.69,38.44,42.25,46.24,46.24,40.96,37.21,33.64,37.21,51.84,53.29,47.61,37.21,33.64,38.44,50.41,59.29,62.41,59.29,54.76,56.25,64,65.61) > 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 8357743.5 2 -7328884.6 3 -7972000.5 4 -4686155.1 5 -480720.8 6 -6283397.0 7 -3692549.0 8 -5086964.0 9 -2193158.1 10 5428761.9 11 3048484.5 12 11310825.9 13 9461264.9 14 -4624107.8 15 2519362.5 16 5021182.5 17 207353.7 18 -2541887.6 19 9987816.5 20 9976353.5 21 2533592.5 22 14831732.7 23 2525191.9 24 7849364.6 25 10399340.3 26 620417.3 27 1405564.6 28 3999408.0 29 6832844.5 30 -4195010.9 31 144068.5 32 1452899.6 33 -3310752.0 34 5328649.4 35 -2654091.1 36 -3732102.7 37 5454001.3 38 -1846116.1 39 744323.3 40 -5584851.0 41 10076277.5 42 -2807797.6 43 -6175906.6 44 -1028880.1 45 3315445.7 46 -191605.1 47 900930.7 48 -4525090.9 49 1458411.9 50 -5657400.4 51 -5587981.3 52 -226861.1 53 -3916848.0 54 -4436556.5 55 822862.5 56 -12398102.3 57 -9249856.5 58 -6432239.1 59 -4353515.1 60 -7633087.5 61 -5179999.6 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1l6ga1256740292.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/21z9l1256740292.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/3sqjy1256740292.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/4ivf21256740292.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/5n5q31256740292.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/6tmru1256740292.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/76uj31256740292.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/8lf391256740292.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. 33.64 44.89 51.84 52.11 59.29 67.24 > > #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/9rs7c1256740292.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/10a6kc1256740292.tab") > > system("convert tmp/1l6ga1256740292.ps tmp/1l6ga1256740292.png") > system("convert tmp/21z9l1256740292.ps tmp/21z9l1256740292.png") > system("convert tmp/3sqjy1256740292.ps tmp/3sqjy1256740292.png") > system("convert tmp/4ivf21256740292.ps tmp/4ivf21256740292.png") > system("convert tmp/5n5q31256740292.ps tmp/5n5q31256740292.png") > system("convert tmp/6tmru1256740292.ps tmp/6tmru1256740292.png") > system("convert tmp/76uj31256740292.ps tmp/76uj31256740292.png") > system("convert tmp/8lf391256740292.ps tmp/8lf391256740292.png") > > > proc.time() user system elapsed 2.635 1.970 2.957