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(2430.47 + ,2516.3 + ,2633.63 + ,2799.84 + ,3001.93 + ,3229.29 + ,3173.02 + ,3322.08 + ,3417.88 + ,3486.95 + ,3016.22 + ,2709.61 + ,2914.87 + ,3203.08 + ,3320.25 + ,3446.25 + ,3456.85 + ,3566.53 + ,3763.67 + ,3607.75 + ,3747.38 + ,3623.91 + ,3699.76 + ,3629.61 + ,3911.52 + ,4281.47 + ,4742.42 + ,4522.42 + ,4879.79 + ,5059.11 + ,5093.19 + ,4941.81 + ,4832.67 + ,4876.18 + ,5018.07 + ,4780.34 + ,4953.59 + ,4622.32 + ,4557.13 + ,4560.03 + ,4105.66 + ,4004.89 + ,4277.26 + ,4245.98 + ,4057.64 + ,3931.42 + ,3637.15 + ,3339.91 + ,3465.74 + ,3571.25 + ,3706.93 + ,3584.17 + ,3552.11 + ,3695.24 + ,3510 + ,3357.7 + ,3060.91 + ,2736.98 + ,2709.45 + ,2314.96 + ,2561.29 + ,2663.49 + ,2407.87 + ,2237.74 + ,2165.44 + ,2098.89 + ,2318.54 + ,2315.49 + ,2395.47 + ,2474.07 + ,2479.57 + ,2386.92 + ,2537.84 + ,2567.13 + ,2660.37 + ,2696.28 + ,2748.5 + ,2663.32 + ,2707.69 + ,2669.36 + ,2687.68 + ,2650.24 + ,2620.03 + ,2668.47 + ,2692.06 + ,2737.67 + ,2774.77 + ,2819.19 + ,2892.56 + ,2866.08 + ,2817.41 + ,2934.75 + ,3036.54 + ,3139.5 + ,3114.31 + ,3261.3 + ,3201.79 + ,3264.53 + ,3349.1 + ,3446.17 + ,3469.48 + ,3507.13 + ,3536.2 + ,3359.05 + ,3378.85 + ,3449.15 + ,3522.89 + ,3551.04 + ,3669.15 + ,3602 + ,3697.22 + ,3760.9 + ,3665.08 + ,3708.8 + ,3858.21 + ,3933.16 + ,3946.98 + ,3794.29 + ,3765.56 + ,3820.33 + ,3885.12 + ,3752.67 + ,3683.79 + ,3240.75 + ,3188.82 + ,3017.98 + ,3237.2 + ,3182.53 + ,2906.42 + ,2881.35 + ,2915.64 + ,2635.13 + ,2331.43 + ,2159.04 + ,2065.46 + ,1983.48 + ,1770.41 + ,1815.99 + ,2026.97 + ,2124.81 + ,2098.28 + ,2291.39 + ,2401.57 + ,2453.89 + ,2409.53) > x <- c(1213.8,1245.6,1306.3,1255.8,1257.6,1287.8,1300.4,1320.9,1370.8,1327.3,1320,1345.3,1346.7,1395.4,1462,1491.6,1461.8,1477.9,1490.3,1521.1,1561.9,1552.6,1523.6,1548.3,1552.4,1587,1621.3,1648.7,1641.8,1650.6,1688.6,1670.7,1682.2,1678.9,1650.6,1662.4,1664.5,1683.2,1736.2,1747.6,1749,1759.7,1793.6,1817.4,1858.4,1839.9,1809.1,1877.7,1880.3,1930.9,2039.3,1992.7,1987.8,1984.4,2016.5,2016.7,2064.1,2031.5,2000.3,2057.8,2041.2,2093.2,2158.3,2128.8,2131.9,2170.3,2190.8,2217.7,2254.4,2223.3,2210.5,2250.8,2249.1,2288.6,2329.2,2313.8,2309.8,2345.9,2361.3,2372,2410.4,2398.5,2362.3,2419.1,2421.6,2465,2480.5,2506.1,2506.6,2525.8,2550,2578.3,2807.8,2815.3,2767.7,2815.4,2838.8,2864,2948.6,2922.8,2917.2,2936.8,2993.4,3007.8,3046.3,3011.5,2958.6,3019.8,2998.5,3040.4,3166,3110,3099.2,3150.3,3163.6,3182.6,3244.4,3223.2,3143.6,3217,3182.3,3217.2,3262.5,3227.9,3171.6,3219,3195.4,3221.6,3262.1,3179.5,3133.6,3219.2,3245,3265.3,3312.5,3383.6,3386.3,3411.1,3467.2,3487.7,3575.5,3571.5,3582.3,3637.1,3685) > 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 -1250.02407 2 -1152.35901 3 -1012.43821 4 -865.02287 5 -662.26296 6 -423.66338 7 -475.24402 8 -318.55450 9 -204.18315 10 -151.30261 11 -624.74946 12 -921.94352 13 -716.16248 14 -409.82773 15 -267.87111 16 -130.85484 17 -131.34554 18 -15.67358 19 186.08134 20 41.62422 21 196.43882 22 69.50762 23 134.56465 24 73.60729 25 357.04319 26 739.87032 27 1213.58580 28 1003.78330 29 1358.58532 30 1541.18043 31 1589.40294 32 1431.36107 33 1326.50104 34 1368.78288 35 1500.14043 36 1266.80205 37 1440.83361 38 1116.52322 39 1071.05830 40 1078.20106 41 624.35210 42 527.56433 43 812.55094 44 790.12863 45 617.04766 46 483.94248 47 178.20960 48 -93.49944 49 33.29821 50 157.64009 51 333.66347 52 193.56028 53 159.67664 54 301.54126 55 128.24796 56 -23.97760 57 -303.12668 58 -639.18947 59 -678.33121 60 -1051.42136 61 -811.26940 62 -689.71649 63 -921.10812 64 -1102.21718 65 -1173.36345 66 -1225.62207 67 -998.34255 68 -991.38114 69 -897.74245 70 -830.71698 71 -829.98077 72 -907.63226 73 -757.34496 74 -713.35418 75 -605.00402 76 -574.82546 77 -524.09415 78 -595.83876 79 -545.73732 80 -580.08508 81 -547.47370 82 -589.34254 83 -633.02515 84 -563.44581 85 -538.92538 86 -477.16314 87 -434.29448 88 -380.34689 89 -306.79081 90 -326.12511 91 -365.78856 92 -237.91611 93 -50.71276 94 55.03852 95 12.13316 96 176.87574 97 126.07455 98 198.19327 99 314.24898 100 401.71696 101 422.94279 102 467.88736 103 518.02226 104 346.23153 105 380.36013 106 437.70856 107 491.76069 108 542.68759 109 652.87033 110 601.31432 111 743.27905 112 786.11745 113 686.27800 114 749.01596 115 903.37584 116 985.39710 117 1022.21730 118 861.63726 119 803.28241 120 885.36980 121 937.24545 122 817.78423 123 765.76360 124 309.84647 125 236.96321 126 83.76414 127 294.20089 128 249.28179 129 -11.75527 130 -67.56663 131 -50.35930 132 -299.01142 133 -593.10940 134 -757.94432 135 -833.95783 136 -889.47644 137 -1101.54157 138 -1046.73172 139 -814.87290 140 -709.40339 141 -703.25673 142 -511.63542 143 -397.43597 144 -324.72097 145 -351.25396 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/19hyq1260383585.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/2ai591260383585.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/3uvo41260383585.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/45uon1260383585.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/53vwv1260383585.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/6x7ic1260383585.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/7wcpt1260383585.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/8ojiz1260383585.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. 1214 1683 2254 2349 3040 3685 > > #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/9ngd81260383586.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/10hz641260383586.tab") > > system("convert tmp/19hyq1260383585.ps tmp/19hyq1260383585.png") > system("convert tmp/2ai591260383585.ps tmp/2ai591260383585.png") > system("convert tmp/3uvo41260383585.ps tmp/3uvo41260383585.png") > system("convert tmp/45uon1260383585.ps tmp/45uon1260383585.png") > system("convert tmp/53vwv1260383585.ps tmp/53vwv1260383585.png") > system("convert tmp/6x7ic1260383585.ps tmp/6x7ic1260383585.png") > system("convert tmp/7wcpt1260383585.ps tmp/7wcpt1260383585.png") > system("convert tmp/8ojiz1260383585.ps tmp/8ojiz1260383585.png") > > > proc.time() user system elapsed 1.655 1.203 2.003