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(3922,3759,4138,4634,3996,4308,4143,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > x <- c(1.84509804,1.812913357,1.875061263,1.653212514,2.495544338,2.008600172,1.698970004,2.361727836,2.167317335,2.012837225,2.201397124,1.86923172,1.763427994,1.857332496,1.763427994,1.995635195,1.662757832,1.84509804,1.86332286,1.913813852,2.243038049,1.919078092,2.130333768,2.1430148,2.222716471,1.716003344,1.819543936,2.11058971,1.892094603,1.982271233,2.113943352,1.770852012,1.875061263,1.968482949,2.178976947,2.064457989,1.903089987,2.037426498,2.212187604,1.838849091,2.025305865,1.838849091,2.11058971,1.954242509,2.149219113,2.086359831,2.045322979,2.356025857,1.892094603,1.880813592,1.944482672,1.69019608,2.227886705,1.86332286,1.982271233,2.130333768,2.195899652,1.86923172,2.017033339,2.320146286) > 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 -636.164892 2 -796.981162 3 -422.197897 4 88.854539 5 -606.297669 6 -261.258511 7 -405.250106 8 -164.218220 9 638.972531 10 359.454005 11 1172.660218 12 1032.197638 13 -389.623580 14 403.005000 15 655.376420 16 186.621163 17 -54.793110 18 1173.835108 19 1171.598554 20 477.172741 21 1516.834881 22 340.815562 23 791.481866 24 999.621458 25 35.213700 26 181.594182 27 454.568954 28 722.821500 29 -415.353609 30 57.527908 31 159.593955 32 -334.127300 33 555.802103 34 -361.536557 35 -459.818573 36 529.951537 37 -262.099645 38 6.785623 39 -774.071916 40 968.259099 41 -323.391992 42 -727.740901 43 -182.178500 44 260.429656 45 -169.799505 46 -5.534503 47 -465.750153 48 201.168659 49 -647.353609 50 -767.588192 51 -159.908139 52 -525.654795 53 -484.137100 54 228.598554 55 -1404.472092 56 -992.518134 57 -678.966779 58 -381.802362 59 -706.830701 60 -403.396912 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1c0r71256909839.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/2ub1p1256909839.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/3lzrj1256909839.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/4vcwq1256909839.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/53ss01256909839.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/6ur1y1256909839.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/71mwk1256909839.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/8hi6r1256909839.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. 1.653 1.862 1.975 1.990 2.130 2.496 > > #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/9a3241256909839.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/10ru0g1256909839.tab") > > system("convert tmp/1c0r71256909839.ps tmp/1c0r71256909839.png") > system("convert tmp/2ub1p1256909839.ps tmp/2ub1p1256909839.png") > system("convert tmp/3lzrj1256909839.ps tmp/3lzrj1256909839.png") > system("convert tmp/4vcwq1256909839.ps tmp/4vcwq1256909839.png") > system("convert tmp/53ss01256909839.ps tmp/53ss01256909839.png") > system("convert tmp/6ur1y1256909839.ps tmp/6ur1y1256909839.png") > system("convert tmp/71mwk1256909839.ps tmp/71mwk1256909839.png") > system("convert tmp/8hi6r1256909839.ps tmp/8hi6r1256909839.png") > > > proc.time() user system elapsed 2.760 2.069 3.246