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(1116.769,2112.077,2236.818,2740.410,4459.006,5475.567,4115.516,5994.941,4208.768,2668.108,1597.828,1759.419,990.975,1873.359,2166.874,2739.628,4554.667,4702.019,3888.894,5456.714,4029.007,2466.443,1348.800,1613.658,925.852,1809.354,1603.775,3072.536,4200.058,4433.796,4879.083,4466.058,3972.851,2210.053,1097.535,1383.348,708.108,1249.717,1366.061,2855.931,3960.223,4160.000,4727.869,4445.694,4192.349,2051.392,1097.705,1389.304,616.954,1125.769,1694.107,2737.042,3904.251,4850.059,4534.207,4666.646,5124.716,2164.238,1238.459,1916.911) > x <- c(6545.183,5768.992,6727.176,6115.951,6500.807,6040.055,6699.799,6318.335,6024.93,6344.79,5449.747,6001.299,6302.456,5298.587,5989.552,6280.586,5995.489,6104.724,6530.002,5716.223,5950.112,5817.888,5263.521,6020.801,6099.384,5442.395,6136.729,5758.553,5673.479,6347.118,6490.806,6154.812,5898.965,5701.613,5469.038,6110.404,5899.754,5258.878,6436.937,6037.73,6138.977,6255.21,5969.169,6347.172,5992.052,6151.677,5430.779,5971.777,6276.719,5319.69,6692.586,6001.459,6742.163,6485.913,6351.912,6518.189,6578.3,6903.007,6124.807,6006.192) > 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 -2378.576247 2 -415.537489 3 -1485.430450 4 -219.782161 5 1018.987367 6 2609.999607 7 427.400341 8 2782.422772 9 1362.057986 10 -577.393498 11 -531.761768 12 -1057.828619 13 -2201.745785 14 -67.769189 15 -635.727826 16 -425.825951 17 1744.663108 18 1755.824313 19 412.475951 20 2994.890257 21 1275.577738 22 -122.133498 23 -548.608993 24 -1227.904105 25 -2013.684942 26 -311.069523 27 -1382.322524 28 557.936531 29 1791.526144 30 1185.392024 31 1451.533302 32 1457.415154 33 1283.190224 34 -233.555451 35 -1056.106186 36 -1569.928335 37 -1982.536477 38 -641.903245 39 -1994.326507 40 -6.737655 41 971.322739 42 1026.184056 43 1950.680064 44 1197.222699 45 1386.630252 46 -953.342225 47 -1008.236056 48 -1391.136509 49 -2543.678695 50 -841.669752 51 -1985.015716 52 -80.405102 53 163.317225 54 1428.609742 55 1279.826015 56 1204.956031 57 1588.081509 58 -1777.231063 59 -1732.774546 60 -906.437059 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1e05s1257363708.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/25h5d1257363708.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/3amsl1257363708.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/4wd8a1257363708.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/5sp0q1257363708.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/6stqk1257363708.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/71c4l1257363708.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/8mhp51257363708.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. 5259 5900 6102 6083 6347 6903 > > #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/93yxq1257363708.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/10sd4a1257363708.tab") > > system("convert tmp/1e05s1257363708.ps tmp/1e05s1257363708.png") > system("convert tmp/25h5d1257363708.ps tmp/25h5d1257363708.png") > system("convert tmp/3amsl1257363708.ps tmp/3amsl1257363708.png") > system("convert tmp/4wd8a1257363708.ps tmp/4wd8a1257363708.png") > system("convert tmp/5sp0q1257363708.ps tmp/5sp0q1257363708.png") > system("convert tmp/6stqk1257363708.ps tmp/6stqk1257363708.png") > system("convert tmp/71c4l1257363708.ps tmp/71c4l1257363708.png") > system("convert tmp/8mhp51257363708.ps tmp/8mhp51257363708.png") > > > proc.time() user system elapsed 1.670 1.210 3.275