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(315844,314721,308025,295936,288369,294849,352836,373321,375769,373321,352836,354025,349281,346921,341056,328329,321489,323761,385641,395641,394384,374544,354025,356409,351649,348100,336400,329476,328329,328329,384400,391876,384400,345744,320356,310249,314721,301401,283024,276676,261121,249001,308025,319225,293764,277729,260100,264196,267289,258064,243049,240100,219961,228484,278784,285156,268324,256036,252004,266256) > x <- c(2252451600,2510410816,3777946225,2886483076,1558433529,1926771025,991053361,893770816,1145280964,1530374400,1135824804,629708836,2646279364,2078812836,2758140324,2358462096,1742645025,2458672225,1072366009,1114157641,1270566025,1371517156,1273133761,439824784,3428336704,3020052025,4295491600,2659464900,2615811025,2175382881,1274775616,1105762009,1238547249,1736222224,1215568225,449864100,3150127876,2423691361,3566836729,2313898609,2253590784,2549947009,1604723481,1166154201,1358659600,2148878736,1337876929,569872384,3280540176,3179719321,3324329649,3881290000,2394047041,2618164224,1571012496,1103103369,1453668129,1874110681,936360000,482065936) > 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 5313.996 2 8175.512 3 21058.249 4 -4800.562 5 -32881.018 6 -20711.566 7 22822.055 8 41804.399 9 48137.302 10 51637.572 11 25058.239 12 18429.618 13 44834.179 14 33708.918 15 38337.017 16 19436.466 17 3084.368 18 16416.342 19 56883.035 20 67528.561 21 68687.493 22 50406.814 23 28368.155 24 17880.611 25 59282.074 26 49426.585 27 57427.412 28 25232.847 29 23411.556 30 16608.569 31 58768.515 32 63633.880 33 58208.921 34 27240.160 35 -6190.020 36 -28124.319 37 18056.776 38 -6483.983 39 -7203.612 40 -32904.875 41 -49391.408 42 -56933.800 43 -12510.010 44 -8084.284 45 -30571.787 46 -34400.822 47 -64556.803 48 -72323.634 49 -27360.836 50 -38143.146 51 -50924.451 52 -45270.472 53 -88381.878 54 -76397.096 55 -42271.720 56 -43127.186 57 -54544.257 58 -60337.973 59 -78854.755 60 -71619.919 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1a8ei1257279712.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/2fnox1257279712.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/3knar1257279712.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/4mb4g1257279712.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/5zelw1257279712.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/6b0u21257279712.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/74nhk1257279712.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/8dryt1257279712.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. 4.398e+08 1.203e+09 1.808e+09 1.960e+09 2.616e+09 4.295e+09 > > #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/9dkak1257279712.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/10b2fq1257279712.tab") > > system("convert tmp/1a8ei1257279712.ps tmp/1a8ei1257279712.png") > system("convert tmp/2fnox1257279712.ps tmp/2fnox1257279712.png") > system("convert tmp/3knar1257279712.ps tmp/3knar1257279712.png") > system("convert tmp/4mb4g1257279712.ps tmp/4mb4g1257279712.png") > system("convert tmp/5zelw1257279712.ps tmp/5zelw1257279712.png") > system("convert tmp/6b0u21257279712.ps tmp/6b0u21257279712.png") > system("convert tmp/74nhk1257279712.ps tmp/74nhk1257279712.png") > system("convert tmp/8dryt1257279712.ps tmp/8dryt1257279712.png") > > > proc.time() user system elapsed 2.130 1.880 3.439