R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(45319,46603,47943,45773,53225,57281,62241,61814,70727,67625,65618,63052,62410,60571,62543,62985,62739,63552,64171,63063,62985,63005,61880,62555,62254,63290,65570,66277,67061,66779,67350,67746,64551,65550,64260,61208,59603,56345,53474,50877,51749,51580,51039,50708,51245,49937,50274,51134,52514,54027,57526,59303,60939,60808,60109,59678,60092,60292,60927,59801,58352,59298,59234,56696,55434,56458,56951,56756) > x <- c(29211,29870,32045,32209,32062,31623,32652,30030,29220,29894,28375,29082,29699,27736,28417,28412,29158,29099,29981,30560,31645,31761,32543,33313,34318,36850,35171,35317,36010,36216,37668,38994,38723,38981,39375,39958,39464,40061,40216,39824,40682,41632,41340,41893,41454,42224,42581,44372,43560,44959,45354,45173,46021,44923,44731,46597,44071,45190,43860,44595,44112,45170,44002,43981,44465,42478,41200,41232) > 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 -15975.6529 2 -14514.8031 3 -12591.1179 4 -14717.1067 5 -7304.5558 6 -3366.3663 7 1869.7772 8 739.1347 9 9434.7623 10 6513.6376 11 4098.9973 12 1722.7285 13 1246.3072 14 -1119.4854 15 1035.2685 16 1475.9266 17 1430.1239 18 2227.2906 19 3082.9850 20 2130.3660 21 2343.5377 22 2394.6675 23 1479.5258 24 2361.1638 25 2329.8665 26 4045.3565 27 5874.7785 28 6620.9592 29 7590.9333 30 7364.2157 31 8324.8758 32 9076.7224 33 5808.9966 34 6877.2338 35 5692.9680 36 2797.4224 37 1059.8521 38 -2037.9364 39 -4867.3404 40 -7569.5379 41 -6467.2842 42 -6381.3413 43 -7000.7027 44 -7183.2991 45 -6764.1096 46 -7865.4716 47 -7432.6668 48 -6092.0323 49 -4929.9414 50 -3041.5044 51 563.4982 52 2291.9249 53 4155.4950 54 3729.8346 55 2979.3093 56 3049.0709 57 2785.1911 58 3285.4870 59 3563.5669 60 2634.8122 61 1056.1939 62 2286.1198 63 1908.6742 64 -634.9614 65 -1767.0747 66 -1276.3079 67 -1126.2733 68 -1312.6857 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/15p241257349988.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/rcomp/tmp/2kg1u1257349988.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/rcomp/tmp/39fvi1257349988.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/rcomp/tmp/42wht1257349988.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/rcomp/tmp/505yj1257349988.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/rcomp/tmp/69c1s1257349988.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/rcomp/tmp/7lknr1257349988.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/rcomp/tmp/8dcwg1257349988.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. 27740 31730 39180 37610 43640 46600 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/9bqs41257349988.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/rcomp/tmp/101xb61257349988.tab") > > system("convert tmp/15p241257349988.ps tmp/15p241257349988.png") > system("convert tmp/2kg1u1257349988.ps tmp/2kg1u1257349988.png") > system("convert tmp/39fvi1257349988.ps tmp/39fvi1257349988.png") > system("convert tmp/42wht1257349988.ps tmp/42wht1257349988.png") > system("convert tmp/505yj1257349988.ps tmp/505yj1257349988.png") > system("convert tmp/69c1s1257349988.ps tmp/69c1s1257349988.png") > system("convert tmp/7lknr1257349988.ps tmp/7lknr1257349988.png") > system("convert tmp/8dcwg1257349988.ps tmp/8dcwg1257349988.png") > > > proc.time() user system elapsed 1.604 1.160 2.710