R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(3030.29,2803.47,2767.63,2882.6,2863.36,2897.06,3012.61,3142.95,3032.93,3045.78,3110.52,3013.24,2987.1,2995.55,2833.18,2848.96,2794.83,2845.26,2915.03,2892.63,2604.42,2641.65,2659.81,2638.53,2720.25,2745.88,2735.7,2811.7,2799.43,2555.28,2304.98,2214.95,2065.81,1940.49,2042,1995.37,1946.81,1765.9,1635.25,1833.42,1910.43,1959.67,1969.6,2061.41,2093.48,2120.88,2174.56,2196.72,2350.44,2440.25,2408.64,2472.81,2407.6,2454.62,2448.05,2497.84,2645.64,2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41) > x <- c(25.64,27.97,27.62,23.31,29.07,29.58,28.63,29.92,32.68,31.54,32.43,26.54,25.85,27.6,25.71,25.38,28.57,27.64,25.36,25.9,26.29,21.74,19.2,19.32,19.82,20.36,24.31,25.97,25.61,24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42,75.73,55.48,43.8,45.29) > 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 411.359604 2 143.045257 3 113.438314 4 305.163950 5 183.345652 6 207.963199 7 340.431494 8 447.798230 9 288.626129 10 321.778084 11 370.668312 12 378.281745 13 364.429770 14 341.714488 15 213.002992 16 234.659874 17 123.720018 18 190.712139 19 301.086049 20 269.069333 21 -26.086072 22 92.173659 23 155.567839 24 132.150791 25 204.966425 26 220.979710 27 140.455217 28 186.892722 29 181.033865 30 -46.375926 31 -313.059960 32 -411.994326 33 -601.738235 34 -708.715241 35 -555.916092 36 -655.972289 37 -753.862477 38 -972.170815 39 -1059.011334 40 -771.797673 41 -705.650999 42 -688.466717 43 -695.633100 44 -627.686801 45 -548.779836 46 -559.312435 47 -499.933641 48 -492.554889 49 -358.602581 50 -265.587010 51 -335.485784 52 -280.576325 53 -415.952729 54 -340.616845 55 -386.544143 56 -409.591858 57 -281.381464 58 -280.675603 59 -107.492046 60 42.858288 61 31.855272 62 101.735126 63 -6.724628 64 8.502420 65 -23.546831 66 -49.827394 67 -30.147311 68 -44.201014 69 -20.967355 70 79.618987 71 202.249446 72 309.278094 73 373.504828 74 551.768633 75 633.517281 76 518.996136 77 355.982517 78 165.646426 79 214.147734 80 376.232433 81 663.752541 82 907.147303 83 978.884455 84 1015.529735 85 1301.402877 86 1301.364061 87 1091.948799 88 1224.194764 89 1329.350502 90 1207.131623 91 1060.240312 92 767.949669 93 774.300706 94 817.763989 95 293.776895 96 340.894360 97 39.676126 98 -116.958116 99 -318.474086 100 -257.421989 101 -570.427732 102 -1020.985179 103 -1548.318423 104 -1182.344050 105 -1006.136123 106 -1313.149792 107 -1135.892965 108 -1079.506973 109 -1063.461984 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1xpwa1291909675.ps",horizontal=F,onefile=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/2xpwa1291909675.ps",horizontal=F,onefile=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/3phdv1291909675.ps",horizontal=F,onefile=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/4phdv1291909675.ps",horizontal=F,onefile=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/5phdv1291909675.ps",horizontal=F,onefile=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/6phdv1291909675.ps",horizontal=F,onefile=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/708ug1291909675.ps",horizontal=F,onefile=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/8sht01291909675.ps",horizontal=F,onefile=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. 19.20 27.60 37.75 48.58 63.52 135.80 > > #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/9l8sl1291909675.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/10z08u1291909675.tab") > > try(system("convert tmp/1xpwa1291909675.ps tmp/1xpwa1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/2xpwa1291909675.ps tmp/2xpwa1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/3phdv1291909675.ps tmp/3phdv1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/4phdv1291909675.ps tmp/4phdv1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/5phdv1291909675.ps tmp/5phdv1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/6phdv1291909675.ps tmp/6phdv1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/708ug1291909675.ps tmp/708ug1291909675.png",intern=TRUE)) character(0) > try(system("convert tmp/8sht01291909675.ps tmp/8sht01291909675.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.190 0.930 3.106