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(87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6) > x <- c(519.8622445,535.3388599,601.2979826,589.7562418,571.7244696,569.2697397,547.4548004,551.5261802,578.9954301,567.0140671,553.7261802,591.518182,506.3011098,533.0479684,598.9424426,573.1043459,588.2562418,570.4333307,553.4215901,565.5498382,595.5161661,560.200865,581.5291007,594.0562418,506.0805807,540.2180184,590.1165031,596.0964686,581.9551603,558.1387446,562.1387446,559.8944185,586.7789998,555.0362368,563.3751829,587.7759383,522.0173321,547.9559209,580.9413968,610.9060133,582.2020143,547.1117561,568.3633973,570.1262601,568.9688714,591.8880552,565.918767,575.897135,543.1117561,526.5163276,588.5787988,583.5244696,535.9474061,526.3459532,508.4268452,525.4542799,553.1177226,532.6388599,528.5480492,558.1548364,490.4666761) > 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 -3.4684196 2 0.8439115 3 -3.5390065 4 -3.5448594 5 -4.0172269 6 -5.5102770 7 -5.3389939 8 -5.3773894 9 -5.6074291 10 -3.5687637 11 -3.9006013 12 -0.5240666 13 -5.5104317 14 0.4970023 15 -3.6646636 16 -2.4708373 17 -4.5517604 18 -5.1927873 19 -2.9004726 20 -5.1874239 21 -0.2383346 22 -3.4290417 23 -1.2403294 24 -0.6584098 25 -0.9379365 26 2.9399727 27 0.8367110 28 0.5709010 29 1.6196109 30 -1.4511553 31 1.2339140 32 1.2716973 33 5.9338573 34 3.6687403 35 4.1274564 36 4.0061311 37 0.9231328 38 4.0962714 39 1.5528681 40 1.6025200 41 1.9384620 42 0.1737760 43 3.8876674 44 5.4081568 45 2.7886283 46 2.7543440 47 3.0912972 48 6.6110817 49 -2.5112934 50 6.7441660 51 3.3422046 52 3.9037277 53 3.2438624 54 1.3001736 55 3.8907697 56 0.4932958 57 1.2994186 58 -0.9685104 59 -1.9237273 60 -0.7564452 61 1.3948639 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1xgab1256741837.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/2bvs51256741837.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/387lt1256741837.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/4e8y71256741837.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/5shsd1256741837.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/6pzgs1256741837.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/7ard61256741837.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/86pha1256741837.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. 490.5 543.1 565.5 561.0 582.2 610.9 > > #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/9jdsl1256741837.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/10v3b11256741837.tab") > > system("convert tmp/1xgab1256741837.ps tmp/1xgab1256741837.png") > system("convert tmp/2bvs51256741837.ps tmp/2bvs51256741837.png") > system("convert tmp/387lt1256741837.ps tmp/387lt1256741837.png") > system("convert tmp/4e8y71256741837.ps tmp/4e8y71256741837.png") > system("convert tmp/5shsd1256741837.ps tmp/5shsd1256741837.png") > system("convert tmp/6pzgs1256741837.ps tmp/6pzgs1256741837.png") > system("convert tmp/7ard61256741837.ps tmp/7ard61256741837.png") > system("convert tmp/86pha1256741837.ps tmp/86pha1256741837.png") > > > proc.time() user system elapsed 1.730 1.540 3.284