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(449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430,424,433,456,459) > x <- c(1080.85,1077.06,1005.58,930.68,909.52,875.57,857.2,822.25,782.3,747.35,755.14,1015.58,1069.9,1068.9,995,921.1,893.15,848.62,834.04,789.3,765.93,747.56,753.35,985.63,1026.37,1014.58,894.73,810.04,761.51,770.3,723.56,671.82,648.45,592.92,569.34,804.83,848.57,791.83,724.72,655.61,653.82,656.82,623.66,574.92,560.34,487.23,512.6,732.51,759.67,727.3,668.98,641.82,667.4,690.98,695.98,693.19,688.4,628.08,664.24,877.36,921.1) > 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 -31.8219869 2 -28.2738592 3 -7.9360840 4 -4.1036923 5 4.9565668 6 9.8665762 7 14.5233323 8 18.5779664 9 18.3557240 10 22.4103581 11 22.2837315 12 0.6176688 13 -7.2383462 14 -8.0937214 15 -3.4059544 16 1.2818126 17 11.3240735 18 20.7642124 19 21.8728409 20 24.3433510 21 24.7232307 22 29.3799869 23 27.5426098 24 8.9491792 25 3.0571680 26 -0.2377065 27 -0.9044335 28 1.3438342 29 7.3624720 30 8.0912207 31 8.8509802 32 5.3338634 33 5.7137432 34 5.7447540 35 -0.8449950 36 -9.9026710 37 -13.2285563 38 -21.0225496 39 -17.3167844 40 -15.3217699 41 -10.0628916 42 -7.4967658 43 -8.7010100 44 -9.6520010 45 -8.5433725 46 -9.9698591 47 -8.6389883 48 -17.4434110 49 -21.3714185 50 -28.6899162 51 -24.2554024 52 -20.3273949 53 -12.0268953 54 -5.4371463 55 -1.1602699 56 3.2432331 57 5.9359855 58 8.6597488 59 12.4301188 60 4.6076979 61 1.2818126 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1xk1g1257075245.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/2suq11257075245.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/31al01257075245.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/45bm51257075245.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/5i01n1257075245.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/6grb01257075245.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/7u0ul1257075245.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/8h9vk1257075245.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. 487.2 669.0 761.5 786.3 893.2 1081.0 > > #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/9xp4r1257075245.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/10ll5v1257075245.tab") > > system("convert tmp/1xk1g1257075245.ps tmp/1xk1g1257075245.png") > system("convert tmp/2suq11257075245.ps tmp/2suq11257075245.png") > system("convert tmp/31al01257075245.ps tmp/31al01257075245.png") > system("convert tmp/45bm51257075245.ps tmp/45bm51257075245.png") > system("convert tmp/5i01n1257075245.ps tmp/5i01n1257075245.png") > system("convert tmp/6grb01257075245.ps tmp/6grb01257075245.png") > system("convert tmp/7u0ul1257075245.ps tmp/7u0ul1257075245.png") > system("convert tmp/8h9vk1257075245.ps tmp/8h9vk1257075245.png") > > > proc.time() user system elapsed 1.576 1.148 2.476