Due in large part to my nonexistent statistics vocabulary, I'm not sure what the name is for the type of analysis I'm trying to do. I have, however, started to cobble something together (below) that is undoubtedly reinventing the wheel (i.e., someone has probably already written something to do this type of analysis, especially within R). I've compiled 1-year's worth of data (which is a subset of a much larger dataset, but extends from 10/1/97 to 9/30/98), that includes daily mean and standard deviations for flow (Q, Qsd) and specific conductance (EC, ECsd). My goal is to calculate total load for the year and include a 95% CI on that value. The load is calculated by multiplying each day's Q and EC and summing over the year. Assuming normally-distributed errors, the calculated load for this data set is 565,240 tons/yr. The last line of code below is where I have left off. For each day in the full 25 year data set, I want to generate ~500 realizations of each day's load (Q*SC), sum over the daily realization values to arrive at 500 realizations of total annual load. So, my question is, what is the package that already does this? or, alternatively, could someone help me complete the code below based on what I just described? -Eric a <- read.csv(textConnection("date,Q,QAcc,Qsd,SC,SCAcc,SCsd 10/1/1997,654,0.15,50.05,1020.00,0.15,78.06 10/2/1997,592,0.15,45.31,1070.00,0.15,81.89 10/3/1997,560,0.15,42.86,1100.00,0.15,84.18 10/4/1997,541,0.15,41.40,1110.00,0.15,84.95 10/5/1997,545,0.15,41.71,1100.00,0.15,84.18 10/6/1997,528,0.15,40.41,1110.00,0.15,84.95 10/7/1997,452,0.15,34.59,1120.00,0.15,85.71 10/8/1997,458,0.15,35.05,NA,0.15,NA 10/9/1997,524,0.15,40.10,NA,0.15,NA 10/10/1997,580,0.15,44.39,NA,0.15,NA 10/11/1997,600,0.15,45.92,NA,0.15,NA 10/12/1997,716,0.15,54.80,NA,0.15,NA 10/13/1997,731,0.15,55.94,NA,0.15,NA 10/14/1997,550,0.15,42.09,NA,0.15,NA 10/15/1997,400,0.15,30.61,NA,0.15,NA 10/16/1997,413,0.15,31.61,NA,0.15,NA 10/17/1997,403,0.15,30.84,1050.00,0.15,80.36 10/18/1997,330,0.15,25.26,1100.00,0.15,84.18 10/19/1997,222,0.15,16.99,1210.00,0.15,92.60 10/20/1997,198,0.15,15.15,NA,0.15,NA 10/21/1997,197,0.15,15.08,NA,0.15,NA 10/22/1997,204,0.15,15.61,1400.00,0.15,107.14 10/23/1997,204,0.15,15.61,1410.00,0.15,107.91 10/24/1997,229,0.15,17.53,1390.00,0.15,106.38 10/25/1997,162,0.15,12.40,1220.00,0.15,93.37 10/26/1997,313,0.15,23.95,1230.00,0.15,94.13 10/27/1997,784,0.15,60.00,987.00,0.15,75.54 10/28/1997,691,0.15,52.88,1010.00,0.15,77.30 10/29/1997,939,0.15,71.86,974.00,0.15,74.54 10/30/1997,953,0.15,72.93,966.00,0.15,73.93 10/31/1997,1020,0.15,78.06,NA,0.15,NA 11/1/1997,1090,0.15,83.42,1000.00,0.15,76.53 11/2/1997,1070,0.15,81.89,991.00,0.15,75.84 11/3/1997,963,0.15,73.70,958.00,0.15,73.32 11/4/1997,896,0.15,68.57,984.00,0.15,75.31 11/5/1997,823,0.15,62.98,1020.00,0.15,78.06 11/6/1997,749,0.15,57.32,1070.00,0.15,81.89 11/7/1997,698,0.15,53.42,1100.00,0.15,84.18 11/8/1997,704,0.15,53.88,1140.00,0.15,87.24 11/9/1997,752,0.15,57.55,1100.00,0.15,84.18 11/10/1997,793,0.15,60.69,1080.00,0.15,82.65 11/11/1997,821,0.15,62.83,1070.00,0.15,81.89 11/12/1997,822,0.15,62.91,1080.00,0.15,82.65 11/13/1997,931,0.15,71.25,1040.00,0.15,79.59 11/14/1997,923,0.15,70.64,1020.00,0.15,78.06 11/15/1997,932,0.15,71.33,1010.00,0.15,77.30 11/16/1997,924,0.15,70.71,987.00,0.15,75.54 11/17/1997,928,0.15,71.02,984.00,0.15,75.31 11/18/1997,947,0.15,72.47,982.00,0.15,75.15 11/19/1997,786,0.15,60.15,1020.00,0.15,78.06 11/20/1997,729,0.15,55.79,1050.00,0.15,80.36 11/21/1997,771,0.15,59.01,1040.00,0.15,79.59 11/22/1997,745,0.15,57.02,1060.00,0.15,81.12 11/23/1997,463,0.15,35.43,1160.00,0.15,88.78 11/24/1997,397,0.15,30.38,1220.00,0.15,93.37 11/25/1997,848,0.15,64.90,1030.00,0.15,78.83 11/26/1997,878,0.15,67.19,971.00,0.15,74.31 11/27/1997,857,0.15,65.59,969.00,0.15,74.16 11/28/1997,939,0.15,71.86,965.00,0.15,73.85 11/29/1997,1130,0.15,86.48,958.00,0.15,73.32 11/30/1997,1040,0.15,79.59,1080.00,0.15,82.65 12/1/1997,956,0.15,73.16,1060.00,0.15,81.12 12/2/1997,1020,0.15,78.06,1040.00,0.15,79.59 12/3/1997,1150,0.15,88.01,944.00,0.15,72.24 12/4/1997,1120,0.15,85.71,933.00,0.15,71.40 12/5/1997,1040,0.15,79.59,928.00,0.15,71.02 12/6/1997,816,0.15,62.45,1020.00,0.15,78.06 12/7/1997,797,0.15,60.99,1060.00,0.15,81.12 12/8/1997,835,0.15,63.90,1070.00,0.15,81.89 12/9/1997,980,0.15,75.00,1020.00,0.15,78.06 12/10/1997,971,0.15,74.31,1020.00,0.15,78.06 12/11/1997,937,0.15,71.71,1030.00,0.15,78.83 12/12/1997,880,0.15,67.35,1010.00,0.15,77.30 12/13/1997,895,0.15,68.49,1050.00,0.15,80.36 12/14/1997,914,0.15,69.95,1030.00,0.15,78.83 12/15/1997,966,0.15,73.93,1020.00,0.15,78.06 12/16/1997,913,0.15,69.87,1010.00,0.15,77.30 12/17/1997,730,0.15,55.87,1160.00,0.15,88.78 12/18/1997,610,0.15,46.68,1290.00,0.15,98.72 12/19/1997,591,0.15,45.23,1350.00,0.15,103.32 12/20/1997,589,0.15,45.08,1360.00,0.15,104.08 12/21/1997,560,0.15,42.86,1370.00,0.15,104.85 12/22/1997,527,0.15,40.33,1380.00,0.15,105.61 12/23/1997,532,0.15,40.71,1390.00,0.15,106.38 12/24/1997,535,0.15,40.94,1400.00,0.15,107.14 12/25/1997,558,0.15,42.70,1390.00,0.15,106.38 12/26/1997,535,0.15,40.94,1380.00,0.15,105.61 12/27/1997,504,0.15,38.57,1410.00,0.15,107.91 12/28/1997,476,0.15,36.43,1400.00,0.15,107.14 12/29/1997,484,0.15,37.04,1410.00,0.15,107.91 12/30/1997,519,0.15,39.72,1400.00,0.15,107.14 12/31/1997,539,0.15,41.25,1410.00,0.15,107.91 1/1/1998,552,0.15,42.24,1400.00,0.15,107.14 1/2/1998,570,0.15,43.62,1400.00,0.15,107.14 1/3/1998,597,0.15,45.69,1420.00,0.15,108.67 1/4/1998,630,0.15,48.21,1400.00,0.15,107.14 1/5/1998,633,0.15,48.44,1390.00,0.15,106.38 1/6/1998,632,0.15,48.37,1390.00,0.15,106.38 1/7/1998,601,0.15,45.99,1390.00,0.15,106.38 1/8/1998,553,0.15,42.32,1430.00,0.15,109.44 1/9/1998,531,0.15,40.64,1440.00,0.15,110.20 1/10/1998,538,0.15,41.17,1430.00,0.15,109.44 1/11/1998,581,0.15,44.46,1400.00,0.15,107.14 1/12/1998,597,0.15,45.69,1400.00,0.15,107.14 1/13/1998,602,0.15,46.07,1390.00,0.15,106.38 1/14/1998,596,0.15,45.61,1390.00,0.15,106.38 1/15/1998,596,0.15,45.61,1380.00,0.15,105.61 1/16/1998,632,0.15,48.37,1390.00,0.15,106.38 1/17/1998,597,0.15,45.69,1390.00,0.15,106.38 1/18/1998,609,0.15,46.61,1400.00,0.15,107.14 1/19/1998,593,0.15,45.38,1400.00,0.15,107.14 1/20/1998,547,0.15,41.86,1410.00,0.15,107.91 1/21/1998,547,0.15,41.86,1400.00,0.15,107.14 1/22/1998,478,0.15,36.58,1400.00,0.15,107.14 1/23/1998,497,0.15,38.04,1400.00,0.15,107.14 1/24/1998,503,0.15,38.49,1390.00,0.15,106.38 1/25/1998,515,0.15,39.41,1370.00,0.15,104.85 1/26/1998,508,0.15,38.88,1370.00,0.15,104.85 1/27/1998,520,0.15,39.80,1350.00,0.15,103.32 1/28/1998,530,0.15,40.56,1340.00,0.15,102.55 1/29/1998,490,0.15,37.50,1320.00,0.15,101.02 1/30/1998,567,0.15,43.39,1320.00,0.15,101.02 1/31/1998,558,0.15,42.70,1340.00,0.15,102.55 2/1/1998,505,0.15,38.65,1340.00,0.15,102.55 2/2/1998,523,0.15,40.03,1370.00,0.15,104.85 2/3/1998,558,0.15,42.70,1380.00,0.15,105.61 2/4/1998,536,0.15,41.02,1400.00,0.15,107.14 2/5/1998,521,0.15,39.87,1400.00,0.15,107.14 2/6/1998,507,0.15,38.80,1400.00,0.15,107.14 2/7/1998,488,0.15,37.35,1390.00,0.15,106.38 2/8/1998,489,0.15,37.42,1390.00,0.15,106.38 2/9/1998,498,0.15,38.11,1390.00,0.15,106.38 2/10/1998,492,0.15,37.65,1390.00,0.15,106.38 2/11/1998,499,0.15,38.19,1380.00,0.15,105.61 2/12/1998,494,0.15,37.81,1380.00,0.15,105.61 2/13/1998,488,0.15,37.35,1390.00,0.15,106.38 2/14/1998,563,0.15,43.09,1380.00,0.15,105.61 2/15/1998,525,0.15,40.18,1300.00,0.15,99.49 2/16/1998,470,0.15,35.97,1360.00,0.15,104.08 2/17/1998,470,0.15,35.97,1380.00,0.15,105.61 2/18/1998,525,0.15,40.18,1380.00,0.15,105.61 2/19/1998,489,0.15,37.42,1370.00,0.15,104.85 2/20/1998,525,0.15,40.18,1370.00,0.15,104.85 2/21/1998,501,0.15,38.34,1380.00,0.15,105.61 2/22/1998,491,0.15,37.58,1390.00,0.15,106.38 2/23/1998,476,0.15,36.43,1400.00,0.15,107.14 2/24/1998,324,0.15,24.80,1460.00,0.15,111.73 2/25/1998,303,0.15,23.19,1520.00,0.15,116.33 2/26/1998,324,0.15,24.80,1500.00,0.15,114.80 2/27/1998,380,0.15,29.08,1350.00,0.15,103.32 2/28/1998,436,0.15,33.37,1240.00,0.15,94.90 3/1/1998,440,0.15,33.67,1230.00,0.15,94.13 3/2/1998,433,0.15,33.14,1220.00,0.15,93.37 3/3/1998,460,0.15,35.20,1220.00,0.15,93.37 3/4/1998,654,0.15,50.05,1180.00,0.15,90.31 3/5/1998,600,0.15,45.92,1190.00,0.15,91.07 3/6/1998,579,0.15,44.31,1250.00,0.15,95.66 3/7/1998,544,0.15,41.63,1280.00,0.15,97.96 3/8/1998,536,0.15,41.02,1280.00,0.15,97.96 3/9/1998,536,0.15,41.02,1270.00,0.15,97.19 3/10/1998,547,0.15,41.86,1270.00,0.15,97.19 3/11/1998,638,0.15,48.83,1210.00,0.15,92.60 3/12/1998,680,0.15,52.04,1130.00,0.15,86.48 3/13/1998,704,0.15,53.88,1100.00,0.15,84.18 3/14/1998,663,0.15,50.74,1100.00,0.15,84.18 3/15/1998,684,0.15,52.35,1090.00,0.15,83.42 3/16/1998,712,0.15,54.49,1080.00,0.15,82.65 3/17/1998,804,0.15,61.53,1050.00,0.15,80.36 3/18/1998,843,0.15,64.52,1040.00,0.15,79.59 3/19/1998,982,0.15,75.15,968.00,0.15,74.08 3/20/1998,1130,0.15,86.48,973.00,0.15,74.46 3/21/1998,1340,0.15,102.55,973.00,0.15,74.46 3/22/1998,1300,0.15,99.49,959.00,0.15,73.39 3/23/1998,1140,0.15,87.24,1010.00,0.15,77.30 3/24/1998,1060,0.15,81.12,1010.00,0.15,77.30 3/25/1998,791,0.15,60.54,1090.00,0.15,83.42 3/26/1998,934,0.15,71.48,1060.00,0.15,81.12 3/27/1998,1070,0.15,81.89,963.00,0.15,73.70 3/28/1998,2140,0.15,163.78,NA,0.15,NA 3/29/1998,1940,0.15,148.47,765.00,0.15,58.55 3/30/1998,1810,0.15,138.52,766.00,0.15,58.62 3/31/1998,1570,0.15,120.15,788.00,0.15,60.31 4/1/1998,1350,0.15,103.32,866.00,0.15,66.28 4/2/1998,1250,0.15,95.66,NA,0.15,NA 4/3/1998,1240,0.15,94.90,NA,0.15,NA 4/4/1998,1260,0.15,96.43,NA,0.15,NA 4/5/1998,1180,0.15,90.31,NA,0.15,NA 4/6/1998,1050,0.15,80.36,1000.00,0.15,76.53 4/7/1998,818,0.15,62.60,1040.00,0.15,79.59 4/8/1998,865,0.15,66.20,NA,0.15,NA 4/9/1998,1010,0.15,77.30,NA,0.15,NA 4/10/1998,1050,0.15,80.36,NA,0.15,NA 4/11/1998,2010,0.15,153.83,NA,0.15,NA 4/12/1998,2720,0.15,208.16,NA,0.15,NA 4/13/1998,2680,0.15,205.10,NA,0.15,NA 4/14/1998,2610,0.15,199.74,704.00,0.15,53.88 4/15/1998,1290,0.15,98.72,768.00,0.15,58.78 4/16/1998,825,0.15,63.14,962.00,0.15,73.62 4/17/1998,1120,0.15,85.71,937.00,0.15,71.71 4/18/1998,984,0.15,75.31,963.00,0.15,73.70 4/19/1998,1040,0.15,79.59,969.00,0.15,74.16 4/20/1998,1110,0.15,84.95,947.00,0.15,72.47 4/21/1998,1100,0.15,84.18,949.00,0.15,72.63 4/22/1998,1040,0.15,79.59,949.00,0.15,72.63 4/23/1998,964,0.15,73.78,950.00,0.15,72.70 4/24/1998,1010,0.15,77.30,933.00,0.15,71.40 4/25/1998,1210,0.15,92.60,859.00,0.15,65.74 4/26/1998,1850,0.15,141.58,780.00,0.15,59.69 4/27/1998,2740,0.15,209.69,749.00,0.15,57.32 4/28/1998,2780,0.15,212.76,780.00,0.15,59.69 4/29/1998,2850,0.15,218.11,761.00,0.15,58.24 4/30/1998,2650,0.15,202.81,729.00,0.15,55.79 5/1/1998,1920,0.15,146.94,736.00,0.15,56.33 5/2/1998,1290,0.15,98.72,825.00,0.15,63.14 5/3/1998,1220,0.15,93.37,832.00,0.15,63.67 5/4/1998,1330,0.15,101.79,832.00,0.15,63.67 5/5/1998,1470,0.15,112.50,818.00,0.15,62.60 5/6/1998,1820,0.15,139.29,824.00,0.15,63.06 5/7/1998,2200,0.15,168.37,795.00,0.15,60.84 5/8/1998,2250,0.15,172.19,796.00,0.15,60.92 5/9/1998,2360,0.15,180.61,830.00,0.15,63.52 5/10/1998,2380,0.15,182.14,815.00,0.15,62.37 5/11/1998,2090,0.15,159.95,831.00,0.15,63.60 5/12/1998,1980,0.15,151.53,863.00,0.15,66.05 5/13/1998,1800,0.15,137.76,874.00,0.15,66.89 5/14/1998,1400,0.15,107.14,849.00,0.15,64.97 5/15/1998,1400,0.15,107.14,807.00,0.15,61.76 5/16/1998,1380,0.15,105.61,801.00,0.15,61.30 5/17/1998,1410,0.15,107.91,782.00,0.15,59.85 5/18/1998,1280,0.15,97.96,789.00,0.15,60.38 5/19/1998,1250,0.15,95.66,786.00,0.15,60.15 5/20/1998,1390,0.15,106.38,761.00,0.15,58.24 5/21/1998,1490,0.15,114.03,764.00,0.15,58.47 5/22/1998,1570,0.15,120.15,745.00,0.15,57.02 5/23/1998,1680,0.15,128.57,721.00,0.15,55.18 5/24/1998,1610,0.15,123.21,727.00,0.15,55.64 5/25/1998,1640,0.15,125.51,753.00,0.15,57.63 5/26/1998,1380,0.15,105.61,802.00,0.15,61.38 5/27/1998,1180,0.15,90.31,795.00,0.15,60.84 5/28/1998,1180,0.15,90.31,792.00,0.15,60.61 5/29/1998,1020,0.15,78.06,811.00,0.15,62.07 5/30/1998,923,0.15,70.64,840.00,0.15,64.29 5/31/1998,1000,0.15,76.53,814.00,0.15,62.30 6/1/1998,1170,0.15,89.54,786.00,0.15,60.15 6/2/1998,1370,0.15,104.85,765.00,0.15,58.55 6/3/1998,1660,0.15,127.04,735.00,0.15,56.25 6/4/1998,1790,0.15,136.99,727.00,0.15,55.64 6/5/1998,2120,0.15,162.24,713.00,0.15,54.57 6/6/1998,2880,0.15,220.41,700.00,0.15,53.57 6/7/1998,3170,0.15,242.60,693.00,0.15,53.04 6/8/1998,2550,0.15,195.15,712.00,0.15,54.49 6/9/1998,1250,0.15,95.66,773.00,0.15,59.16 6/10/1998,595,0.15,45.54,964.00,0.15,73.78 6/11/1998,559,0.15,42.78,1040.00,0.15,79.59 6/12/1998,612,0.15,46.84,1060.00,0.15,81.12 6/13/1998,563,0.15,43.09,1090.00,0.15,83.42 6/14/1998,616,0.15,47.14,998.00,0.15,76.38 6/15/1998,679,0.15,51.96,942.00,0.15,72.09 6/16/1998,1040,0.15,79.59,868.00,0.15,66.43 6/17/1998,1020,0.15,78.06,847.00,0.15,64.82 6/18/1998,889,0.15,68.04,860.00,0.15,65.82 6/19/1998,792,0.15,60.61,886.00,0.15,67.81 6/20/1998,744,0.15,56.94,913.00,0.15,69.87 6/21/1998,680,0.15,52.04,927.00,0.15,70.94 6/22/1998,664,0.15,50.82,930.00,0.15,71.17 6/23/1998,703,0.15,53.80,929.00,0.15,71.10 6/24/1998,699,0.15,53.49,879.00,0.15,67.27 6/25/1998,682,0.15,52.19,867.00,0.15,66.35 6/26/1998,856,0.15,65.51,816.00,0.15,62.45 6/27/1998,993,0.15,75.99,777.00,0.15,59.46 6/28/1998,1130,0.15,86.48,709.00,0.15,54.26 6/29/1998,1290,0.15,98.72,671.00,0.15,51.35 6/30/1998,1290,0.15,98.72,653.00,0.15,49.97 7/1/1998,1370,0.15,104.85,651.00,0.15,49.82 7/2/1998,1460,0.15,111.73,731.00,0.15,55.94 7/3/1998,1540,0.15,117.86,687.00,0.15,52.58 7/4/1998,1520,0.15,116.33,632.00,0.15,48.37 7/5/1998,1450,0.15,110.97,647.00,0.15,49.52 7/6/1998,1070,0.15,81.89,673.00,0.15,51.51 7/7/1998,1160,0.15,88.78,653.00,0.15,49.97 7/8/1998,1360,0.15,104.08,642.00,0.15,49.13 7/9/1998,1190,0.15,91.07,660.00,0.15,50.51 7/10/1998,1140,0.15,87.24,681.00,0.15,52.12 7/11/1998,1380,0.15,105.61,663.00,0.15,50.74 7/12/1998,1550,0.15,118.62,638.00,0.15,48.83 7/13/1998,1020,0.15,78.06,640.00,0.15,48.98 7/14/1998,912,0.15,69.80,655.00,0.15,50.13 7/15/1998,995,0.15,76.15,636.00,0.15,48.67 7/16/1998,955,0.15,73.09,641.00,0.15,49.06 7/17/1998,924,0.15,70.71,635.00,0.15,48.60 7/18/1998,961,0.15,73.55,663.00,0.15,50.74 7/19/1998,824,0.15,63.06,695.00,0.15,53.19 7/20/1998,656,0.15,50.20,768.00,0.15,58.78 7/21/1998,596,0.15,45.61,746.00,0.15,57.09 7/22/1998,535,0.15,40.94,777.00,0.15,59.46 7/23/1998,579,0.15,44.31,763.00,0.15,58.39 7/24/1998,938,0.15,71.79,719.00,0.15,55.03 7/25/1998,993,0.15,75.99,704.00,0.15,53.88 7/26/1998,1220,0.15,93.37,711.00,0.15,54.41 7/27/1998,1360,0.15,104.08,681.00,0.15,52.12 7/28/1998,1200,0.15,91.84,697.00,0.15,53.34 7/29/1998,1340,0.15,102.55,630.00,0.15,48.21 7/30/1998,3200,0.15,244.90,602.00,0.15,46.07 7/31/1998,2850,0.15,218.11,628.00,0.15,48.06 8/1/1998,2570,0.15,196.68,684.00,0.15,52.35 8/2/1998,1880,0.15,143.88,710.00,0.15,54.34 8/3/1998,1900,0.15,145.41,684.00,0.15,52.35 8/4/1998,2450,0.15,187.50,756.00,0.15,57.86 8/5/1998,2760,0.15,211.22,717.00,0.15,54.87 8/6/1998,1320,0.15,101.02,837.00,0.15,64.06 8/7/1998,1030,0.15,78.83,934.00,0.15,71.48 8/8/1998,1080,0.15,82.65,883.00,0.15,67.58 8/9/1998,744,0.15,56.94,1010.00,0.15,77.30 8/10/1998,1250,0.15,95.66,910.00,0.15,69.64 8/11/1998,1360,0.15,104.08,927.00,0.15,70.94 8/12/1998,1670,0.15,127.81,889.00,0.15,68.04 8/13/1998,1210,0.15,92.60,1010.00,0.15,77.30 8/14/1998,668,0.15,51.12,1010.00,0.15,77.30 8/15/1998,1180,0.15,90.31,911.00,0.15,69.72 8/16/1998,1450,0.15,110.97,871.00,0.15,66.66 8/17/1998,1350,0.15,103.32,843.00,0.15,64.52 8/18/1998,1260,0.15,96.43,853.00,0.15,65.28 8/19/1998,936,0.15,71.63,897.00,0.15,68.65 8/20/1998,672,0.15,51.43,1000.00,0.15,76.53 8/21/1998,714,0.15,54.64,982.00,0.15,75.15 8/22/1998,771,0.15,59.01,974.00,0.15,74.54 8/23/1998,598,0.15,45.77,1000.00,0.15,76.53 8/24/1998,488,0.15,37.35,NA,0.15,NA 8/25/1998,528,0.15,40.41,NA,0.15,NA 8/26/1998,812,0.15,62.14,936.00,0.15,71.63 8/27/1998,720,0.15,55.10,993.00,0.15,75.99 8/28/1998,653,0.15,49.97,944.00,0.15,72.24 8/29/1998,796,0.15,60.92,892.00,0.15,68.27 8/30/1998,689,0.15,52.73,901.00,0.15,68.95 8/31/1998,511,0.15,39.11,1020.00,0.15,78.06 9/1/1998,410,0.15,31.38,1150.00,0.15,88.01 9/2/1998,374,0.15,28.62,1180.00,0.15,90.31 9/3/1998,444,0.15,33.98,1170.00,0.15,89.54 9/4/1998,473,0.15,36.20,1150.00,0.15,88.01 9/5/1998,727,0.15,55.64,951.00,0.15,72.78 9/6/1998,1130,0.15,86.48,735.00,0.15,56.25 9/7/1998,1090,0.15,83.42,737.00,0.15,56.40 9/8/1998,1020,0.15,78.06,773.00,0.15,59.16 9/9/1998,916,0.15,70.10,793.00,0.15,60.69 9/10/1998,859,0.15,65.74,820.00,0.15,62.76 9/11/1998,595,0.15,45.54,900.00,0.15,68.88 9/12/1998,458,0.15,35.05,1060.00,0.15,81.12 9/13/1998,429,0.15,32.83,1160.00,0.15,88.78 9/14/1998,418,0.15,31.99,1110.00,0.15,84.95 9/15/1998,493,0.15,37.73,1150.00,0.15,88.01 9/16/1998,438,0.15,33.52,1170.00,0.15,89.54 9/17/1998,406,0.15,31.07,1150.00,0.15,88.01 9/18/1998,397,0.15,30.38,1140.00,0.15,87.24 9/19/1998,429,0.15,32.83,1110.00,0.15,84.95 9/20/1998,450,0.15,34.44,1080.00,0.15,82.65 9/21/1998,449,0.15,34.36,1060.00,0.15,81.12 9/22/1998,450,0.15,34.44,1090.00,0.15,83.42 9/23/1998,478,0.15,36.58,1060.00,0.15,81.12 9/24/1998,531,0.15,40.64,1030.00,0.15,78.83 9/25/1998,573,0.15,43.85,999.00,0.15,76.45 9/26/1998,533,0.15,40.79,1040.00,0.15,79.59 9/27/1998,564,0.15,43.16,1020.00,0.15,78.06 9/28/1998,434,0.15,33.21,1130.00,0.15,86.48 9/29/1998,399,0.15,30.54,1180.00,0.15,90.31 9/30/1998,359,0.15,27.47,1230.00,0.15,94.13"),header=T) closeAllConnections() a[,1] <- transform(a$date,as.Date(a[,1],"%m/%d/%Y")) #convert cfs to cfd Cat.Dam.ConvertQ <- function(Q) (Q * 86400) #convert SC to TDS using locally regressed data (and do unit conversion) Cat.Dam.ConvertSC <- function(SC) ((0.8652 * SC - 145.43) * (28.3168/1000000/907.185)) # estimated annul load, omits missing days sum(Cat.Dam.ConvertQ(a$Q) * Cat.Dam.Convert(a$SC), na.rm=TRUE) # 565239.3 # 10 realizations for the first day Cat.Dam.ConvertQ(rnorm(10,a$Q[1],a$Qsd[1])) * Cat.Dam.ConvertSC(rnorm(10,a$SC[1],a$SCsd[1])) [[alternative HTML version deleted]]
Have you read "An Introduction to R" (or a web tutorial) to learn R? This looks straightforward, if I understand you correctly. ?sample and indexing operations might be all you need. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Wed, Apr 9, 2014 at 11:09 AM, Morway, Eric <emorway at usgs.gov> wrote:> Due in large part to my nonexistent statistics vocabulary, I'm not sure > what the name is for the type of analysis I'm trying to do. I have, > however, started to cobble something together (below) that is undoubtedly > reinventing the wheel (i.e., someone has probably already written something > to do this type of analysis, especially within R). I've compiled 1-year's > worth of data (which is a subset of a much larger dataset, but extends from > 10/1/97 to 9/30/98), that includes daily mean and standard deviations for > flow (Q, Qsd) and specific conductance (EC, ECsd). My goal is to calculate > total load for the year and include a 95% CI on that value. The load is > calculated by multiplying each day's Q and EC and summing over the year. > Assuming normally-distributed errors, the calculated load for this data > set is 565,240 tons/yr. The last line of code below is where I have left > off. For each day in the full 25 year data set, I want to generate ~500 > realizations of each day's load (Q*SC), sum over the daily realization > values to arrive at 500 realizations of total annual load. So, my question > is, what is the package that already does this? or, alternatively, could > someone help me complete the code below based on what I just described? > -Eric > > > a <- read.csv(textConnection("date,Q,QAcc,Qsd,SC,SCAcc,SCsd > 10/1/1997,654,0.15,50.05,1020.00,0.15,78.06 > 10/2/1997,592,0.15,45.31,1070.00,0.15,81.89 > 10/3/1997,560,0.15,42.86,1100.00,0.15,84.18 > 10/4/1997,541,0.15,41.40,1110.00,0.15,84.95 > 10/5/1997,545,0.15,41.71,1100.00,0.15,84.18 > 10/6/1997,528,0.15,40.41,1110.00,0.15,84.95 > 10/7/1997,452,0.15,34.59,1120.00,0.15,85.71 > 10/8/1997,458,0.15,35.05,NA,0.15,NA > 10/9/1997,524,0.15,40.10,NA,0.15,NA > 10/10/1997,580,0.15,44.39,NA,0.15,NA > 10/11/1997,600,0.15,45.92,NA,0.15,NA > 10/12/1997,716,0.15,54.80,NA,0.15,NA > 10/13/1997,731,0.15,55.94,NA,0.15,NA > 10/14/1997,550,0.15,42.09,NA,0.15,NA > 10/15/1997,400,0.15,30.61,NA,0.15,NA > 10/16/1997,413,0.15,31.61,NA,0.15,NA > 10/17/1997,403,0.15,30.84,1050.00,0.15,80.36 > 10/18/1997,330,0.15,25.26,1100.00,0.15,84.18 > 10/19/1997,222,0.15,16.99,1210.00,0.15,92.60 > 10/20/1997,198,0.15,15.15,NA,0.15,NA > 10/21/1997,197,0.15,15.08,NA,0.15,NA > 10/22/1997,204,0.15,15.61,1400.00,0.15,107.14 > 10/23/1997,204,0.15,15.61,1410.00,0.15,107.91 > 10/24/1997,229,0.15,17.53,1390.00,0.15,106.38 > 10/25/1997,162,0.15,12.40,1220.00,0.15,93.37 > 10/26/1997,313,0.15,23.95,1230.00,0.15,94.13 > 10/27/1997,784,0.15,60.00,987.00,0.15,75.54 > 10/28/1997,691,0.15,52.88,1010.00,0.15,77.30 > 10/29/1997,939,0.15,71.86,974.00,0.15,74.54 > 10/30/1997,953,0.15,72.93,966.00,0.15,73.93 > 10/31/1997,1020,0.15,78.06,NA,0.15,NA > 11/1/1997,1090,0.15,83.42,1000.00,0.15,76.53 > 11/2/1997,1070,0.15,81.89,991.00,0.15,75.84 > 11/3/1997,963,0.15,73.70,958.00,0.15,73.32 > 11/4/1997,896,0.15,68.57,984.00,0.15,75.31 > 11/5/1997,823,0.15,62.98,1020.00,0.15,78.06 > 11/6/1997,749,0.15,57.32,1070.00,0.15,81.89 > 11/7/1997,698,0.15,53.42,1100.00,0.15,84.18 > 11/8/1997,704,0.15,53.88,1140.00,0.15,87.24 > 11/9/1997,752,0.15,57.55,1100.00,0.15,84.18 > 11/10/1997,793,0.15,60.69,1080.00,0.15,82.65 > 11/11/1997,821,0.15,62.83,1070.00,0.15,81.89 > 11/12/1997,822,0.15,62.91,1080.00,0.15,82.65 > 11/13/1997,931,0.15,71.25,1040.00,0.15,79.59 > 11/14/1997,923,0.15,70.64,1020.00,0.15,78.06 > 11/15/1997,932,0.15,71.33,1010.00,0.15,77.30 > 11/16/1997,924,0.15,70.71,987.00,0.15,75.54 > 11/17/1997,928,0.15,71.02,984.00,0.15,75.31 > 11/18/1997,947,0.15,72.47,982.00,0.15,75.15 > 11/19/1997,786,0.15,60.15,1020.00,0.15,78.06 > 11/20/1997,729,0.15,55.79,1050.00,0.15,80.36 > 11/21/1997,771,0.15,59.01,1040.00,0.15,79.59 > 11/22/1997,745,0.15,57.02,1060.00,0.15,81.12 > 11/23/1997,463,0.15,35.43,1160.00,0.15,88.78 > 11/24/1997,397,0.15,30.38,1220.00,0.15,93.37 > 11/25/1997,848,0.15,64.90,1030.00,0.15,78.83 > 11/26/1997,878,0.15,67.19,971.00,0.15,74.31 > 11/27/1997,857,0.15,65.59,969.00,0.15,74.16 > 11/28/1997,939,0.15,71.86,965.00,0.15,73.85 > 11/29/1997,1130,0.15,86.48,958.00,0.15,73.32 > 11/30/1997,1040,0.15,79.59,1080.00,0.15,82.65 > 12/1/1997,956,0.15,73.16,1060.00,0.15,81.12 > 12/2/1997,1020,0.15,78.06,1040.00,0.15,79.59 > 12/3/1997,1150,0.15,88.01,944.00,0.15,72.24 > 12/4/1997,1120,0.15,85.71,933.00,0.15,71.40 > 12/5/1997,1040,0.15,79.59,928.00,0.15,71.02 > 12/6/1997,816,0.15,62.45,1020.00,0.15,78.06 > 12/7/1997,797,0.15,60.99,1060.00,0.15,81.12 > 12/8/1997,835,0.15,63.90,1070.00,0.15,81.89 > 12/9/1997,980,0.15,75.00,1020.00,0.15,78.06 > 12/10/1997,971,0.15,74.31,1020.00,0.15,78.06 > 12/11/1997,937,0.15,71.71,1030.00,0.15,78.83 > 12/12/1997,880,0.15,67.35,1010.00,0.15,77.30 > 12/13/1997,895,0.15,68.49,1050.00,0.15,80.36 > 12/14/1997,914,0.15,69.95,1030.00,0.15,78.83 > 12/15/1997,966,0.15,73.93,1020.00,0.15,78.06 > 12/16/1997,913,0.15,69.87,1010.00,0.15,77.30 > 12/17/1997,730,0.15,55.87,1160.00,0.15,88.78 > 12/18/1997,610,0.15,46.68,1290.00,0.15,98.72 > 12/19/1997,591,0.15,45.23,1350.00,0.15,103.32 > 12/20/1997,589,0.15,45.08,1360.00,0.15,104.08 > 12/21/1997,560,0.15,42.86,1370.00,0.15,104.85 > 12/22/1997,527,0.15,40.33,1380.00,0.15,105.61 > 12/23/1997,532,0.15,40.71,1390.00,0.15,106.38 > 12/24/1997,535,0.15,40.94,1400.00,0.15,107.14 > 12/25/1997,558,0.15,42.70,1390.00,0.15,106.38 > 12/26/1997,535,0.15,40.94,1380.00,0.15,105.61 > 12/27/1997,504,0.15,38.57,1410.00,0.15,107.91 > 12/28/1997,476,0.15,36.43,1400.00,0.15,107.14 > 12/29/1997,484,0.15,37.04,1410.00,0.15,107.91 > 12/30/1997,519,0.15,39.72,1400.00,0.15,107.14 > 12/31/1997,539,0.15,41.25,1410.00,0.15,107.91 > 1/1/1998,552,0.15,42.24,1400.00,0.15,107.14 > 1/2/1998,570,0.15,43.62,1400.00,0.15,107.14 > 1/3/1998,597,0.15,45.69,1420.00,0.15,108.67 > 1/4/1998,630,0.15,48.21,1400.00,0.15,107.14 > 1/5/1998,633,0.15,48.44,1390.00,0.15,106.38 > 1/6/1998,632,0.15,48.37,1390.00,0.15,106.38 > 1/7/1998,601,0.15,45.99,1390.00,0.15,106.38 > 1/8/1998,553,0.15,42.32,1430.00,0.15,109.44 > 1/9/1998,531,0.15,40.64,1440.00,0.15,110.20 > 1/10/1998,538,0.15,41.17,1430.00,0.15,109.44 > 1/11/1998,581,0.15,44.46,1400.00,0.15,107.14 > 1/12/1998,597,0.15,45.69,1400.00,0.15,107.14 > 1/13/1998,602,0.15,46.07,1390.00,0.15,106.38 > 1/14/1998,596,0.15,45.61,1390.00,0.15,106.38 > 1/15/1998,596,0.15,45.61,1380.00,0.15,105.61 > 1/16/1998,632,0.15,48.37,1390.00,0.15,106.38 > 1/17/1998,597,0.15,45.69,1390.00,0.15,106.38 > 1/18/1998,609,0.15,46.61,1400.00,0.15,107.14 > 1/19/1998,593,0.15,45.38,1400.00,0.15,107.14 > 1/20/1998,547,0.15,41.86,1410.00,0.15,107.91 > 1/21/1998,547,0.15,41.86,1400.00,0.15,107.14 > 1/22/1998,478,0.15,36.58,1400.00,0.15,107.14 > 1/23/1998,497,0.15,38.04,1400.00,0.15,107.14 > 1/24/1998,503,0.15,38.49,1390.00,0.15,106.38 > 1/25/1998,515,0.15,39.41,1370.00,0.15,104.85 > 1/26/1998,508,0.15,38.88,1370.00,0.15,104.85 > 1/27/1998,520,0.15,39.80,1350.00,0.15,103.32 > 1/28/1998,530,0.15,40.56,1340.00,0.15,102.55 > 1/29/1998,490,0.15,37.50,1320.00,0.15,101.02 > 1/30/1998,567,0.15,43.39,1320.00,0.15,101.02 > 1/31/1998,558,0.15,42.70,1340.00,0.15,102.55 > 2/1/1998,505,0.15,38.65,1340.00,0.15,102.55 > 2/2/1998,523,0.15,40.03,1370.00,0.15,104.85 > 2/3/1998,558,0.15,42.70,1380.00,0.15,105.61 > 2/4/1998,536,0.15,41.02,1400.00,0.15,107.14 > 2/5/1998,521,0.15,39.87,1400.00,0.15,107.14 > 2/6/1998,507,0.15,38.80,1400.00,0.15,107.14 > 2/7/1998,488,0.15,37.35,1390.00,0.15,106.38 > 2/8/1998,489,0.15,37.42,1390.00,0.15,106.38 > 2/9/1998,498,0.15,38.11,1390.00,0.15,106.38 > 2/10/1998,492,0.15,37.65,1390.00,0.15,106.38 > 2/11/1998,499,0.15,38.19,1380.00,0.15,105.61 > 2/12/1998,494,0.15,37.81,1380.00,0.15,105.61 > 2/13/1998,488,0.15,37.35,1390.00,0.15,106.38 > 2/14/1998,563,0.15,43.09,1380.00,0.15,105.61 > 2/15/1998,525,0.15,40.18,1300.00,0.15,99.49 > 2/16/1998,470,0.15,35.97,1360.00,0.15,104.08 > 2/17/1998,470,0.15,35.97,1380.00,0.15,105.61 > 2/18/1998,525,0.15,40.18,1380.00,0.15,105.61 > 2/19/1998,489,0.15,37.42,1370.00,0.15,104.85 > 2/20/1998,525,0.15,40.18,1370.00,0.15,104.85 > 2/21/1998,501,0.15,38.34,1380.00,0.15,105.61 > 2/22/1998,491,0.15,37.58,1390.00,0.15,106.38 > 2/23/1998,476,0.15,36.43,1400.00,0.15,107.14 > 2/24/1998,324,0.15,24.80,1460.00,0.15,111.73 > 2/25/1998,303,0.15,23.19,1520.00,0.15,116.33 > 2/26/1998,324,0.15,24.80,1500.00,0.15,114.80 > 2/27/1998,380,0.15,29.08,1350.00,0.15,103.32 > 2/28/1998,436,0.15,33.37,1240.00,0.15,94.90 > 3/1/1998,440,0.15,33.67,1230.00,0.15,94.13 > 3/2/1998,433,0.15,33.14,1220.00,0.15,93.37 > 3/3/1998,460,0.15,35.20,1220.00,0.15,93.37 > 3/4/1998,654,0.15,50.05,1180.00,0.15,90.31 > 3/5/1998,600,0.15,45.92,1190.00,0.15,91.07 > 3/6/1998,579,0.15,44.31,1250.00,0.15,95.66 > 3/7/1998,544,0.15,41.63,1280.00,0.15,97.96 > 3/8/1998,536,0.15,41.02,1280.00,0.15,97.96 > 3/9/1998,536,0.15,41.02,1270.00,0.15,97.19 > 3/10/1998,547,0.15,41.86,1270.00,0.15,97.19 > 3/11/1998,638,0.15,48.83,1210.00,0.15,92.60 > 3/12/1998,680,0.15,52.04,1130.00,0.15,86.48 > 3/13/1998,704,0.15,53.88,1100.00,0.15,84.18 > 3/14/1998,663,0.15,50.74,1100.00,0.15,84.18 > 3/15/1998,684,0.15,52.35,1090.00,0.15,83.42 > 3/16/1998,712,0.15,54.49,1080.00,0.15,82.65 > 3/17/1998,804,0.15,61.53,1050.00,0.15,80.36 > 3/18/1998,843,0.15,64.52,1040.00,0.15,79.59 > 3/19/1998,982,0.15,75.15,968.00,0.15,74.08 > 3/20/1998,1130,0.15,86.48,973.00,0.15,74.46 > 3/21/1998,1340,0.15,102.55,973.00,0.15,74.46 > 3/22/1998,1300,0.15,99.49,959.00,0.15,73.39 > 3/23/1998,1140,0.15,87.24,1010.00,0.15,77.30 > 3/24/1998,1060,0.15,81.12,1010.00,0.15,77.30 > 3/25/1998,791,0.15,60.54,1090.00,0.15,83.42 > 3/26/1998,934,0.15,71.48,1060.00,0.15,81.12 > 3/27/1998,1070,0.15,81.89,963.00,0.15,73.70 > 3/28/1998,2140,0.15,163.78,NA,0.15,NA > 3/29/1998,1940,0.15,148.47,765.00,0.15,58.55 > 3/30/1998,1810,0.15,138.52,766.00,0.15,58.62 > 3/31/1998,1570,0.15,120.15,788.00,0.15,60.31 > 4/1/1998,1350,0.15,103.32,866.00,0.15,66.28 > 4/2/1998,1250,0.15,95.66,NA,0.15,NA > 4/3/1998,1240,0.15,94.90,NA,0.15,NA > 4/4/1998,1260,0.15,96.43,NA,0.15,NA > 4/5/1998,1180,0.15,90.31,NA,0.15,NA > 4/6/1998,1050,0.15,80.36,1000.00,0.15,76.53 > 4/7/1998,818,0.15,62.60,1040.00,0.15,79.59 > 4/8/1998,865,0.15,66.20,NA,0.15,NA > 4/9/1998,1010,0.15,77.30,NA,0.15,NA > 4/10/1998,1050,0.15,80.36,NA,0.15,NA > 4/11/1998,2010,0.15,153.83,NA,0.15,NA > 4/12/1998,2720,0.15,208.16,NA,0.15,NA > 4/13/1998,2680,0.15,205.10,NA,0.15,NA > 4/14/1998,2610,0.15,199.74,704.00,0.15,53.88 > 4/15/1998,1290,0.15,98.72,768.00,0.15,58.78 > 4/16/1998,825,0.15,63.14,962.00,0.15,73.62 > 4/17/1998,1120,0.15,85.71,937.00,0.15,71.71 > 4/18/1998,984,0.15,75.31,963.00,0.15,73.70 > 4/19/1998,1040,0.15,79.59,969.00,0.15,74.16 > 4/20/1998,1110,0.15,84.95,947.00,0.15,72.47 > 4/21/1998,1100,0.15,84.18,949.00,0.15,72.63 > 4/22/1998,1040,0.15,79.59,949.00,0.15,72.63 > 4/23/1998,964,0.15,73.78,950.00,0.15,72.70 > 4/24/1998,1010,0.15,77.30,933.00,0.15,71.40 > 4/25/1998,1210,0.15,92.60,859.00,0.15,65.74 > 4/26/1998,1850,0.15,141.58,780.00,0.15,59.69 > 4/27/1998,2740,0.15,209.69,749.00,0.15,57.32 > 4/28/1998,2780,0.15,212.76,780.00,0.15,59.69 > 4/29/1998,2850,0.15,218.11,761.00,0.15,58.24 > 4/30/1998,2650,0.15,202.81,729.00,0.15,55.79 > 5/1/1998,1920,0.15,146.94,736.00,0.15,56.33 > 5/2/1998,1290,0.15,98.72,825.00,0.15,63.14 > 5/3/1998,1220,0.15,93.37,832.00,0.15,63.67 > 5/4/1998,1330,0.15,101.79,832.00,0.15,63.67 > 5/5/1998,1470,0.15,112.50,818.00,0.15,62.60 > 5/6/1998,1820,0.15,139.29,824.00,0.15,63.06 > 5/7/1998,2200,0.15,168.37,795.00,0.15,60.84 > 5/8/1998,2250,0.15,172.19,796.00,0.15,60.92 > 5/9/1998,2360,0.15,180.61,830.00,0.15,63.52 > 5/10/1998,2380,0.15,182.14,815.00,0.15,62.37 > 5/11/1998,2090,0.15,159.95,831.00,0.15,63.60 > 5/12/1998,1980,0.15,151.53,863.00,0.15,66.05 > 5/13/1998,1800,0.15,137.76,874.00,0.15,66.89 > 5/14/1998,1400,0.15,107.14,849.00,0.15,64.97 > 5/15/1998,1400,0.15,107.14,807.00,0.15,61.76 > 5/16/1998,1380,0.15,105.61,801.00,0.15,61.30 > 5/17/1998,1410,0.15,107.91,782.00,0.15,59.85 > 5/18/1998,1280,0.15,97.96,789.00,0.15,60.38 > 5/19/1998,1250,0.15,95.66,786.00,0.15,60.15 > 5/20/1998,1390,0.15,106.38,761.00,0.15,58.24 > 5/21/1998,1490,0.15,114.03,764.00,0.15,58.47 > 5/22/1998,1570,0.15,120.15,745.00,0.15,57.02 > 5/23/1998,1680,0.15,128.57,721.00,0.15,55.18 > 5/24/1998,1610,0.15,123.21,727.00,0.15,55.64 > 5/25/1998,1640,0.15,125.51,753.00,0.15,57.63 > 5/26/1998,1380,0.15,105.61,802.00,0.15,61.38 > 5/27/1998,1180,0.15,90.31,795.00,0.15,60.84 > 5/28/1998,1180,0.15,90.31,792.00,0.15,60.61 > 5/29/1998,1020,0.15,78.06,811.00,0.15,62.07 > 5/30/1998,923,0.15,70.64,840.00,0.15,64.29 > 5/31/1998,1000,0.15,76.53,814.00,0.15,62.30 > 6/1/1998,1170,0.15,89.54,786.00,0.15,60.15 > 6/2/1998,1370,0.15,104.85,765.00,0.15,58.55 > 6/3/1998,1660,0.15,127.04,735.00,0.15,56.25 > 6/4/1998,1790,0.15,136.99,727.00,0.15,55.64 > 6/5/1998,2120,0.15,162.24,713.00,0.15,54.57 > 6/6/1998,2880,0.15,220.41,700.00,0.15,53.57 > 6/7/1998,3170,0.15,242.60,693.00,0.15,53.04 > 6/8/1998,2550,0.15,195.15,712.00,0.15,54.49 > 6/9/1998,1250,0.15,95.66,773.00,0.15,59.16 > 6/10/1998,595,0.15,45.54,964.00,0.15,73.78 > 6/11/1998,559,0.15,42.78,1040.00,0.15,79.59 > 6/12/1998,612,0.15,46.84,1060.00,0.15,81.12 > 6/13/1998,563,0.15,43.09,1090.00,0.15,83.42 > 6/14/1998,616,0.15,47.14,998.00,0.15,76.38 > 6/15/1998,679,0.15,51.96,942.00,0.15,72.09 > 6/16/1998,1040,0.15,79.59,868.00,0.15,66.43 > 6/17/1998,1020,0.15,78.06,847.00,0.15,64.82 > 6/18/1998,889,0.15,68.04,860.00,0.15,65.82 > 6/19/1998,792,0.15,60.61,886.00,0.15,67.81 > 6/20/1998,744,0.15,56.94,913.00,0.15,69.87 > 6/21/1998,680,0.15,52.04,927.00,0.15,70.94 > 6/22/1998,664,0.15,50.82,930.00,0.15,71.17 > 6/23/1998,703,0.15,53.80,929.00,0.15,71.10 > 6/24/1998,699,0.15,53.49,879.00,0.15,67.27 > 6/25/1998,682,0.15,52.19,867.00,0.15,66.35 > 6/26/1998,856,0.15,65.51,816.00,0.15,62.45 > 6/27/1998,993,0.15,75.99,777.00,0.15,59.46 > 6/28/1998,1130,0.15,86.48,709.00,0.15,54.26 > 6/29/1998,1290,0.15,98.72,671.00,0.15,51.35 > 6/30/1998,1290,0.15,98.72,653.00,0.15,49.97 > 7/1/1998,1370,0.15,104.85,651.00,0.15,49.82 > 7/2/1998,1460,0.15,111.73,731.00,0.15,55.94 > 7/3/1998,1540,0.15,117.86,687.00,0.15,52.58 > 7/4/1998,1520,0.15,116.33,632.00,0.15,48.37 > 7/5/1998,1450,0.15,110.97,647.00,0.15,49.52 > 7/6/1998,1070,0.15,81.89,673.00,0.15,51.51 > 7/7/1998,1160,0.15,88.78,653.00,0.15,49.97 > 7/8/1998,1360,0.15,104.08,642.00,0.15,49.13 > 7/9/1998,1190,0.15,91.07,660.00,0.15,50.51 > 7/10/1998,1140,0.15,87.24,681.00,0.15,52.12 > 7/11/1998,1380,0.15,105.61,663.00,0.15,50.74 > 7/12/1998,1550,0.15,118.62,638.00,0.15,48.83 > 7/13/1998,1020,0.15,78.06,640.00,0.15,48.98 > 7/14/1998,912,0.15,69.80,655.00,0.15,50.13 > 7/15/1998,995,0.15,76.15,636.00,0.15,48.67 > 7/16/1998,955,0.15,73.09,641.00,0.15,49.06 > 7/17/1998,924,0.15,70.71,635.00,0.15,48.60 > 7/18/1998,961,0.15,73.55,663.00,0.15,50.74 > 7/19/1998,824,0.15,63.06,695.00,0.15,53.19 > 7/20/1998,656,0.15,50.20,768.00,0.15,58.78 > 7/21/1998,596,0.15,45.61,746.00,0.15,57.09 > 7/22/1998,535,0.15,40.94,777.00,0.15,59.46 > 7/23/1998,579,0.15,44.31,763.00,0.15,58.39 > 7/24/1998,938,0.15,71.79,719.00,0.15,55.03 > 7/25/1998,993,0.15,75.99,704.00,0.15,53.88 > 7/26/1998,1220,0.15,93.37,711.00,0.15,54.41 > 7/27/1998,1360,0.15,104.08,681.00,0.15,52.12 > 7/28/1998,1200,0.15,91.84,697.00,0.15,53.34 > 7/29/1998,1340,0.15,102.55,630.00,0.15,48.21 > 7/30/1998,3200,0.15,244.90,602.00,0.15,46.07 > 7/31/1998,2850,0.15,218.11,628.00,0.15,48.06 > 8/1/1998,2570,0.15,196.68,684.00,0.15,52.35 > 8/2/1998,1880,0.15,143.88,710.00,0.15,54.34 > 8/3/1998,1900,0.15,145.41,684.00,0.15,52.35 > 8/4/1998,2450,0.15,187.50,756.00,0.15,57.86 > 8/5/1998,2760,0.15,211.22,717.00,0.15,54.87 > 8/6/1998,1320,0.15,101.02,837.00,0.15,64.06 > 8/7/1998,1030,0.15,78.83,934.00,0.15,71.48 > 8/8/1998,1080,0.15,82.65,883.00,0.15,67.58 > 8/9/1998,744,0.15,56.94,1010.00,0.15,77.30 > 8/10/1998,1250,0.15,95.66,910.00,0.15,69.64 > 8/11/1998,1360,0.15,104.08,927.00,0.15,70.94 > 8/12/1998,1670,0.15,127.81,889.00,0.15,68.04 > 8/13/1998,1210,0.15,92.60,1010.00,0.15,77.30 > 8/14/1998,668,0.15,51.12,1010.00,0.15,77.30 > 8/15/1998,1180,0.15,90.31,911.00,0.15,69.72 > 8/16/1998,1450,0.15,110.97,871.00,0.15,66.66 > 8/17/1998,1350,0.15,103.32,843.00,0.15,64.52 > 8/18/1998,1260,0.15,96.43,853.00,0.15,65.28 > 8/19/1998,936,0.15,71.63,897.00,0.15,68.65 > 8/20/1998,672,0.15,51.43,1000.00,0.15,76.53 > 8/21/1998,714,0.15,54.64,982.00,0.15,75.15 > 8/22/1998,771,0.15,59.01,974.00,0.15,74.54 > 8/23/1998,598,0.15,45.77,1000.00,0.15,76.53 > 8/24/1998,488,0.15,37.35,NA,0.15,NA > 8/25/1998,528,0.15,40.41,NA,0.15,NA > 8/26/1998,812,0.15,62.14,936.00,0.15,71.63 > 8/27/1998,720,0.15,55.10,993.00,0.15,75.99 > 8/28/1998,653,0.15,49.97,944.00,0.15,72.24 > 8/29/1998,796,0.15,60.92,892.00,0.15,68.27 > 8/30/1998,689,0.15,52.73,901.00,0.15,68.95 > 8/31/1998,511,0.15,39.11,1020.00,0.15,78.06 > 9/1/1998,410,0.15,31.38,1150.00,0.15,88.01 > 9/2/1998,374,0.15,28.62,1180.00,0.15,90.31 > 9/3/1998,444,0.15,33.98,1170.00,0.15,89.54 > 9/4/1998,473,0.15,36.20,1150.00,0.15,88.01 > 9/5/1998,727,0.15,55.64,951.00,0.15,72.78 > 9/6/1998,1130,0.15,86.48,735.00,0.15,56.25 > 9/7/1998,1090,0.15,83.42,737.00,0.15,56.40 > 9/8/1998,1020,0.15,78.06,773.00,0.15,59.16 > 9/9/1998,916,0.15,70.10,793.00,0.15,60.69 > 9/10/1998,859,0.15,65.74,820.00,0.15,62.76 > 9/11/1998,595,0.15,45.54,900.00,0.15,68.88 > 9/12/1998,458,0.15,35.05,1060.00,0.15,81.12 > 9/13/1998,429,0.15,32.83,1160.00,0.15,88.78 > 9/14/1998,418,0.15,31.99,1110.00,0.15,84.95 > 9/15/1998,493,0.15,37.73,1150.00,0.15,88.01 > 9/16/1998,438,0.15,33.52,1170.00,0.15,89.54 > 9/17/1998,406,0.15,31.07,1150.00,0.15,88.01 > 9/18/1998,397,0.15,30.38,1140.00,0.15,87.24 > 9/19/1998,429,0.15,32.83,1110.00,0.15,84.95 > 9/20/1998,450,0.15,34.44,1080.00,0.15,82.65 > 9/21/1998,449,0.15,34.36,1060.00,0.15,81.12 > 9/22/1998,450,0.15,34.44,1090.00,0.15,83.42 > 9/23/1998,478,0.15,36.58,1060.00,0.15,81.12 > 9/24/1998,531,0.15,40.64,1030.00,0.15,78.83 > 9/25/1998,573,0.15,43.85,999.00,0.15,76.45 > 9/26/1998,533,0.15,40.79,1040.00,0.15,79.59 > 9/27/1998,564,0.15,43.16,1020.00,0.15,78.06 > 9/28/1998,434,0.15,33.21,1130.00,0.15,86.48 > 9/29/1998,399,0.15,30.54,1180.00,0.15,90.31 > 9/30/1998,359,0.15,27.47,1230.00,0.15,94.13"),header=T) > closeAllConnections() > a[,1] <- transform(a$date,as.Date(a[,1],"%m/%d/%Y")) > > #convert cfs to cfd > Cat.Dam.ConvertQ <- function(Q) (Q * 86400) > #convert SC to TDS using locally regressed data (and do unit conversion) > Cat.Dam.ConvertSC <- function(SC) ((0.8652 * SC - 145.43) * > (28.3168/1000000/907.185)) > > # estimated annul load, omits missing days > sum(Cat.Dam.ConvertQ(a$Q) * Cat.Dam.Convert(a$SC), na.rm=TRUE) > # 565239.3 > > # 10 realizations for the first day > Cat.Dam.ConvertQ(rnorm(10,a$Q[1],a$Qsd[1])) * > Cat.Dam.ConvertSC(rnorm(10,a$SC[1],a$SCsd[1])) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
You might be thinking of bootstrap analysis. Note that measures are often correlated, so beware of just introducing randomness one measure at a time. Discussions about background theory are not really R-specific, so further chatter about this would not be on topic here, but the term "bootstrap" should get you started. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On April 9, 2014 11:09:35 AM PDT, "Morway, Eric" <emorway at usgs.gov> wrote:>Due in large part to my nonexistent statistics vocabulary, I'm not sure >what the name is for the type of analysis I'm trying to do. I have, >however, started to cobble something together (below) that is >undoubtedly >reinventing the wheel (i.e., someone has probably already written >something >to do this type of analysis, especially within R). I've compiled >1-year's >worth of data (which is a subset of a much larger dataset, but extends >from >10/1/97 to 9/30/98), that includes daily mean and standard deviations >for >flow (Q, Qsd) and specific conductance (EC, ECsd). My goal is to >calculate >total load for the year and include a 95% CI on that value. The load >is >calculated by multiplying each day's Q and EC and summing over the >year. >Assuming normally-distributed errors, the calculated load for this data >set is 565,240 tons/yr. The last line of code below is where I have >left >off. For each day in the full 25 year data set, I want to generate >~500 >realizations of each day's load (Q*SC), sum over the daily realization >values to arrive at 500 realizations of total annual load. So, my >question >is, what is the package that already does this? or, alternatively, >could >someone help me complete the code below based on what I just described? >-Eric > > >a <- read.csv(textConnection("date,Q,QAcc,Qsd,SC,SCAcc,SCsd >10/1/1997,654,0.15,50.05,1020.00,0.15,78.06 >10/2/1997,592,0.15,45.31,1070.00,0.15,81.89 >10/3/1997,560,0.15,42.86,1100.00,0.15,84.18 >10/4/1997,541,0.15,41.40,1110.00,0.15,84.95 >10/5/1997,545,0.15,41.71,1100.00,0.15,84.18 >10/6/1997,528,0.15,40.41,1110.00,0.15,84.95 >10/7/1997,452,0.15,34.59,1120.00,0.15,85.71 >10/8/1997,458,0.15,35.05,NA,0.15,NA >10/9/1997,524,0.15,40.10,NA,0.15,NA >10/10/1997,580,0.15,44.39,NA,0.15,NA >10/11/1997,600,0.15,45.92,NA,0.15,NA >10/12/1997,716,0.15,54.80,NA,0.15,NA >10/13/1997,731,0.15,55.94,NA,0.15,NA >10/14/1997,550,0.15,42.09,NA,0.15,NA >10/15/1997,400,0.15,30.61,NA,0.15,NA >10/16/1997,413,0.15,31.61,NA,0.15,NA >10/17/1997,403,0.15,30.84,1050.00,0.15,80.36 >10/18/1997,330,0.15,25.26,1100.00,0.15,84.18 >10/19/1997,222,0.15,16.99,1210.00,0.15,92.60 >10/20/1997,198,0.15,15.15,NA,0.15,NA >10/21/1997,197,0.15,15.08,NA,0.15,NA >10/22/1997,204,0.15,15.61,1400.00,0.15,107.14 >10/23/1997,204,0.15,15.61,1410.00,0.15,107.91 >10/24/1997,229,0.15,17.53,1390.00,0.15,106.38 >10/25/1997,162,0.15,12.40,1220.00,0.15,93.37 >10/26/1997,313,0.15,23.95,1230.00,0.15,94.13 >10/27/1997,784,0.15,60.00,987.00,0.15,75.54 >10/28/1997,691,0.15,52.88,1010.00,0.15,77.30 >10/29/1997,939,0.15,71.86,974.00,0.15,74.54 >10/30/1997,953,0.15,72.93,966.00,0.15,73.93 >10/31/1997,1020,0.15,78.06,NA,0.15,NA >11/1/1997,1090,0.15,83.42,1000.00,0.15,76.53 >11/2/1997,1070,0.15,81.89,991.00,0.15,75.84 >11/3/1997,963,0.15,73.70,958.00,0.15,73.32 >11/4/1997,896,0.15,68.57,984.00,0.15,75.31 >11/5/1997,823,0.15,62.98,1020.00,0.15,78.06 >11/6/1997,749,0.15,57.32,1070.00,0.15,81.89 >11/7/1997,698,0.15,53.42,1100.00,0.15,84.18 >11/8/1997,704,0.15,53.88,1140.00,0.15,87.24 >11/9/1997,752,0.15,57.55,1100.00,0.15,84.18 >11/10/1997,793,0.15,60.69,1080.00,0.15,82.65 >11/11/1997,821,0.15,62.83,1070.00,0.15,81.89 >11/12/1997,822,0.15,62.91,1080.00,0.15,82.65 >11/13/1997,931,0.15,71.25,1040.00,0.15,79.59 >11/14/1997,923,0.15,70.64,1020.00,0.15,78.06 >11/15/1997,932,0.15,71.33,1010.00,0.15,77.30 >11/16/1997,924,0.15,70.71,987.00,0.15,75.54 >11/17/1997,928,0.15,71.02,984.00,0.15,75.31 >11/18/1997,947,0.15,72.47,982.00,0.15,75.15 >11/19/1997,786,0.15,60.15,1020.00,0.15,78.06 >11/20/1997,729,0.15,55.79,1050.00,0.15,80.36 >11/21/1997,771,0.15,59.01,1040.00,0.15,79.59 >11/22/1997,745,0.15,57.02,1060.00,0.15,81.12 >11/23/1997,463,0.15,35.43,1160.00,0.15,88.78 >11/24/1997,397,0.15,30.38,1220.00,0.15,93.37 >11/25/1997,848,0.15,64.90,1030.00,0.15,78.83 >11/26/1997,878,0.15,67.19,971.00,0.15,74.31 >11/27/1997,857,0.15,65.59,969.00,0.15,74.16 >11/28/1997,939,0.15,71.86,965.00,0.15,73.85 >11/29/1997,1130,0.15,86.48,958.00,0.15,73.32 >11/30/1997,1040,0.15,79.59,1080.00,0.15,82.65 >12/1/1997,956,0.15,73.16,1060.00,0.15,81.12 >12/2/1997,1020,0.15,78.06,1040.00,0.15,79.59 >12/3/1997,1150,0.15,88.01,944.00,0.15,72.24 >12/4/1997,1120,0.15,85.71,933.00,0.15,71.40 >12/5/1997,1040,0.15,79.59,928.00,0.15,71.02 >12/6/1997,816,0.15,62.45,1020.00,0.15,78.06 >12/7/1997,797,0.15,60.99,1060.00,0.15,81.12 >12/8/1997,835,0.15,63.90,1070.00,0.15,81.89 >12/9/1997,980,0.15,75.00,1020.00,0.15,78.06 >12/10/1997,971,0.15,74.31,1020.00,0.15,78.06 >12/11/1997,937,0.15,71.71,1030.00,0.15,78.83 >12/12/1997,880,0.15,67.35,1010.00,0.15,77.30 >12/13/1997,895,0.15,68.49,1050.00,0.15,80.36 >12/14/1997,914,0.15,69.95,1030.00,0.15,78.83 >12/15/1997,966,0.15,73.93,1020.00,0.15,78.06 >12/16/1997,913,0.15,69.87,1010.00,0.15,77.30 >12/17/1997,730,0.15,55.87,1160.00,0.15,88.78 >12/18/1997,610,0.15,46.68,1290.00,0.15,98.72 >12/19/1997,591,0.15,45.23,1350.00,0.15,103.32 >12/20/1997,589,0.15,45.08,1360.00,0.15,104.08 >12/21/1997,560,0.15,42.86,1370.00,0.15,104.85 >12/22/1997,527,0.15,40.33,1380.00,0.15,105.61 >12/23/1997,532,0.15,40.71,1390.00,0.15,106.38 >12/24/1997,535,0.15,40.94,1400.00,0.15,107.14 >12/25/1997,558,0.15,42.70,1390.00,0.15,106.38 >12/26/1997,535,0.15,40.94,1380.00,0.15,105.61 >12/27/1997,504,0.15,38.57,1410.00,0.15,107.91 >12/28/1997,476,0.15,36.43,1400.00,0.15,107.14 >12/29/1997,484,0.15,37.04,1410.00,0.15,107.91 >12/30/1997,519,0.15,39.72,1400.00,0.15,107.14 >12/31/1997,539,0.15,41.25,1410.00,0.15,107.91 >1/1/1998,552,0.15,42.24,1400.00,0.15,107.14 >1/2/1998,570,0.15,43.62,1400.00,0.15,107.14 >1/3/1998,597,0.15,45.69,1420.00,0.15,108.67 >1/4/1998,630,0.15,48.21,1400.00,0.15,107.14 >1/5/1998,633,0.15,48.44,1390.00,0.15,106.38 >1/6/1998,632,0.15,48.37,1390.00,0.15,106.38 >1/7/1998,601,0.15,45.99,1390.00,0.15,106.38 >1/8/1998,553,0.15,42.32,1430.00,0.15,109.44 >1/9/1998,531,0.15,40.64,1440.00,0.15,110.20 >1/10/1998,538,0.15,41.17,1430.00,0.15,109.44 >1/11/1998,581,0.15,44.46,1400.00,0.15,107.14 >1/12/1998,597,0.15,45.69,1400.00,0.15,107.14 >1/13/1998,602,0.15,46.07,1390.00,0.15,106.38 >1/14/1998,596,0.15,45.61,1390.00,0.15,106.38 >1/15/1998,596,0.15,45.61,1380.00,0.15,105.61 >1/16/1998,632,0.15,48.37,1390.00,0.15,106.38 >1/17/1998,597,0.15,45.69,1390.00,0.15,106.38 >1/18/1998,609,0.15,46.61,1400.00,0.15,107.14 >1/19/1998,593,0.15,45.38,1400.00,0.15,107.14 >1/20/1998,547,0.15,41.86,1410.00,0.15,107.91 >1/21/1998,547,0.15,41.86,1400.00,0.15,107.14 >1/22/1998,478,0.15,36.58,1400.00,0.15,107.14 >1/23/1998,497,0.15,38.04,1400.00,0.15,107.14 >1/24/1998,503,0.15,38.49,1390.00,0.15,106.38 >1/25/1998,515,0.15,39.41,1370.00,0.15,104.85 >1/26/1998,508,0.15,38.88,1370.00,0.15,104.85 >1/27/1998,520,0.15,39.80,1350.00,0.15,103.32 >1/28/1998,530,0.15,40.56,1340.00,0.15,102.55 >1/29/1998,490,0.15,37.50,1320.00,0.15,101.02 >1/30/1998,567,0.15,43.39,1320.00,0.15,101.02 >1/31/1998,558,0.15,42.70,1340.00,0.15,102.55 >2/1/1998,505,0.15,38.65,1340.00,0.15,102.55 >2/2/1998,523,0.15,40.03,1370.00,0.15,104.85 >2/3/1998,558,0.15,42.70,1380.00,0.15,105.61 >2/4/1998,536,0.15,41.02,1400.00,0.15,107.14 >2/5/1998,521,0.15,39.87,1400.00,0.15,107.14 >2/6/1998,507,0.15,38.80,1400.00,0.15,107.14 >2/7/1998,488,0.15,37.35,1390.00,0.15,106.38 >2/8/1998,489,0.15,37.42,1390.00,0.15,106.38 >2/9/1998,498,0.15,38.11,1390.00,0.15,106.38 >2/10/1998,492,0.15,37.65,1390.00,0.15,106.38 >2/11/1998,499,0.15,38.19,1380.00,0.15,105.61 >2/12/1998,494,0.15,37.81,1380.00,0.15,105.61 >2/13/1998,488,0.15,37.35,1390.00,0.15,106.38 >2/14/1998,563,0.15,43.09,1380.00,0.15,105.61 >2/15/1998,525,0.15,40.18,1300.00,0.15,99.49 >2/16/1998,470,0.15,35.97,1360.00,0.15,104.08 >2/17/1998,470,0.15,35.97,1380.00,0.15,105.61 >2/18/1998,525,0.15,40.18,1380.00,0.15,105.61 >2/19/1998,489,0.15,37.42,1370.00,0.15,104.85 >2/20/1998,525,0.15,40.18,1370.00,0.15,104.85 >2/21/1998,501,0.15,38.34,1380.00,0.15,105.61 >2/22/1998,491,0.15,37.58,1390.00,0.15,106.38 >2/23/1998,476,0.15,36.43,1400.00,0.15,107.14 >2/24/1998,324,0.15,24.80,1460.00,0.15,111.73 >2/25/1998,303,0.15,23.19,1520.00,0.15,116.33 >2/26/1998,324,0.15,24.80,1500.00,0.15,114.80 >2/27/1998,380,0.15,29.08,1350.00,0.15,103.32 >2/28/1998,436,0.15,33.37,1240.00,0.15,94.90 >3/1/1998,440,0.15,33.67,1230.00,0.15,94.13 >3/2/1998,433,0.15,33.14,1220.00,0.15,93.37 >3/3/1998,460,0.15,35.20,1220.00,0.15,93.37 >3/4/1998,654,0.15,50.05,1180.00,0.15,90.31 >3/5/1998,600,0.15,45.92,1190.00,0.15,91.07 >3/6/1998,579,0.15,44.31,1250.00,0.15,95.66 >3/7/1998,544,0.15,41.63,1280.00,0.15,97.96 >3/8/1998,536,0.15,41.02,1280.00,0.15,97.96 >3/9/1998,536,0.15,41.02,1270.00,0.15,97.19 >3/10/1998,547,0.15,41.86,1270.00,0.15,97.19 >3/11/1998,638,0.15,48.83,1210.00,0.15,92.60 >3/12/1998,680,0.15,52.04,1130.00,0.15,86.48 >3/13/1998,704,0.15,53.88,1100.00,0.15,84.18 >3/14/1998,663,0.15,50.74,1100.00,0.15,84.18 >3/15/1998,684,0.15,52.35,1090.00,0.15,83.42 >3/16/1998,712,0.15,54.49,1080.00,0.15,82.65 >3/17/1998,804,0.15,61.53,1050.00,0.15,80.36 >3/18/1998,843,0.15,64.52,1040.00,0.15,79.59 >3/19/1998,982,0.15,75.15,968.00,0.15,74.08 >3/20/1998,1130,0.15,86.48,973.00,0.15,74.46 >3/21/1998,1340,0.15,102.55,973.00,0.15,74.46 >3/22/1998,1300,0.15,99.49,959.00,0.15,73.39 >3/23/1998,1140,0.15,87.24,1010.00,0.15,77.30 >3/24/1998,1060,0.15,81.12,1010.00,0.15,77.30 >3/25/1998,791,0.15,60.54,1090.00,0.15,83.42 >3/26/1998,934,0.15,71.48,1060.00,0.15,81.12 >3/27/1998,1070,0.15,81.89,963.00,0.15,73.70 >3/28/1998,2140,0.15,163.78,NA,0.15,NA >3/29/1998,1940,0.15,148.47,765.00,0.15,58.55 >3/30/1998,1810,0.15,138.52,766.00,0.15,58.62 >3/31/1998,1570,0.15,120.15,788.00,0.15,60.31 >4/1/1998,1350,0.15,103.32,866.00,0.15,66.28 >4/2/1998,1250,0.15,95.66,NA,0.15,NA >4/3/1998,1240,0.15,94.90,NA,0.15,NA >4/4/1998,1260,0.15,96.43,NA,0.15,NA >4/5/1998,1180,0.15,90.31,NA,0.15,NA >4/6/1998,1050,0.15,80.36,1000.00,0.15,76.53 >4/7/1998,818,0.15,62.60,1040.00,0.15,79.59 >4/8/1998,865,0.15,66.20,NA,0.15,NA >4/9/1998,1010,0.15,77.30,NA,0.15,NA >4/10/1998,1050,0.15,80.36,NA,0.15,NA >4/11/1998,2010,0.15,153.83,NA,0.15,NA >4/12/1998,2720,0.15,208.16,NA,0.15,NA >4/13/1998,2680,0.15,205.10,NA,0.15,NA >4/14/1998,2610,0.15,199.74,704.00,0.15,53.88 >4/15/1998,1290,0.15,98.72,768.00,0.15,58.78 >4/16/1998,825,0.15,63.14,962.00,0.15,73.62 >4/17/1998,1120,0.15,85.71,937.00,0.15,71.71 >4/18/1998,984,0.15,75.31,963.00,0.15,73.70 >4/19/1998,1040,0.15,79.59,969.00,0.15,74.16 >4/20/1998,1110,0.15,84.95,947.00,0.15,72.47 >4/21/1998,1100,0.15,84.18,949.00,0.15,72.63 >4/22/1998,1040,0.15,79.59,949.00,0.15,72.63 >4/23/1998,964,0.15,73.78,950.00,0.15,72.70 >4/24/1998,1010,0.15,77.30,933.00,0.15,71.40 >4/25/1998,1210,0.15,92.60,859.00,0.15,65.74 >4/26/1998,1850,0.15,141.58,780.00,0.15,59.69 >4/27/1998,2740,0.15,209.69,749.00,0.15,57.32 >4/28/1998,2780,0.15,212.76,780.00,0.15,59.69 >4/29/1998,2850,0.15,218.11,761.00,0.15,58.24 >4/30/1998,2650,0.15,202.81,729.00,0.15,55.79 >5/1/1998,1920,0.15,146.94,736.00,0.15,56.33 >5/2/1998,1290,0.15,98.72,825.00,0.15,63.14 >5/3/1998,1220,0.15,93.37,832.00,0.15,63.67 >5/4/1998,1330,0.15,101.79,832.00,0.15,63.67 >5/5/1998,1470,0.15,112.50,818.00,0.15,62.60 >5/6/1998,1820,0.15,139.29,824.00,0.15,63.06 >5/7/1998,2200,0.15,168.37,795.00,0.15,60.84 >5/8/1998,2250,0.15,172.19,796.00,0.15,60.92 >5/9/1998,2360,0.15,180.61,830.00,0.15,63.52 >5/10/1998,2380,0.15,182.14,815.00,0.15,62.37 >5/11/1998,2090,0.15,159.95,831.00,0.15,63.60 >5/12/1998,1980,0.15,151.53,863.00,0.15,66.05 >5/13/1998,1800,0.15,137.76,874.00,0.15,66.89 >5/14/1998,1400,0.15,107.14,849.00,0.15,64.97 >5/15/1998,1400,0.15,107.14,807.00,0.15,61.76 >5/16/1998,1380,0.15,105.61,801.00,0.15,61.30 >5/17/1998,1410,0.15,107.91,782.00,0.15,59.85 >5/18/1998,1280,0.15,97.96,789.00,0.15,60.38 >5/19/1998,1250,0.15,95.66,786.00,0.15,60.15 >5/20/1998,1390,0.15,106.38,761.00,0.15,58.24 >5/21/1998,1490,0.15,114.03,764.00,0.15,58.47 >5/22/1998,1570,0.15,120.15,745.00,0.15,57.02 >5/23/1998,1680,0.15,128.57,721.00,0.15,55.18 >5/24/1998,1610,0.15,123.21,727.00,0.15,55.64 >5/25/1998,1640,0.15,125.51,753.00,0.15,57.63 >5/26/1998,1380,0.15,105.61,802.00,0.15,61.38 >5/27/1998,1180,0.15,90.31,795.00,0.15,60.84 >5/28/1998,1180,0.15,90.31,792.00,0.15,60.61 >5/29/1998,1020,0.15,78.06,811.00,0.15,62.07 >5/30/1998,923,0.15,70.64,840.00,0.15,64.29 >5/31/1998,1000,0.15,76.53,814.00,0.15,62.30 >6/1/1998,1170,0.15,89.54,786.00,0.15,60.15 >6/2/1998,1370,0.15,104.85,765.00,0.15,58.55 >6/3/1998,1660,0.15,127.04,735.00,0.15,56.25 >6/4/1998,1790,0.15,136.99,727.00,0.15,55.64 >6/5/1998,2120,0.15,162.24,713.00,0.15,54.57 >6/6/1998,2880,0.15,220.41,700.00,0.15,53.57 >6/7/1998,3170,0.15,242.60,693.00,0.15,53.04 >6/8/1998,2550,0.15,195.15,712.00,0.15,54.49 >6/9/1998,1250,0.15,95.66,773.00,0.15,59.16 >6/10/1998,595,0.15,45.54,964.00,0.15,73.78 >6/11/1998,559,0.15,42.78,1040.00,0.15,79.59 >6/12/1998,612,0.15,46.84,1060.00,0.15,81.12 >6/13/1998,563,0.15,43.09,1090.00,0.15,83.42 >6/14/1998,616,0.15,47.14,998.00,0.15,76.38 >6/15/1998,679,0.15,51.96,942.00,0.15,72.09 >6/16/1998,1040,0.15,79.59,868.00,0.15,66.43 >6/17/1998,1020,0.15,78.06,847.00,0.15,64.82 >6/18/1998,889,0.15,68.04,860.00,0.15,65.82 >6/19/1998,792,0.15,60.61,886.00,0.15,67.81 >6/20/1998,744,0.15,56.94,913.00,0.15,69.87 >6/21/1998,680,0.15,52.04,927.00,0.15,70.94 >6/22/1998,664,0.15,50.82,930.00,0.15,71.17 >6/23/1998,703,0.15,53.80,929.00,0.15,71.10 >6/24/1998,699,0.15,53.49,879.00,0.15,67.27 >6/25/1998,682,0.15,52.19,867.00,0.15,66.35 >6/26/1998,856,0.15,65.51,816.00,0.15,62.45 >6/27/1998,993,0.15,75.99,777.00,0.15,59.46 >6/28/1998,1130,0.15,86.48,709.00,0.15,54.26 >6/29/1998,1290,0.15,98.72,671.00,0.15,51.35 >6/30/1998,1290,0.15,98.72,653.00,0.15,49.97 >7/1/1998,1370,0.15,104.85,651.00,0.15,49.82 >7/2/1998,1460,0.15,111.73,731.00,0.15,55.94 >7/3/1998,1540,0.15,117.86,687.00,0.15,52.58 >7/4/1998,1520,0.15,116.33,632.00,0.15,48.37 >7/5/1998,1450,0.15,110.97,647.00,0.15,49.52 >7/6/1998,1070,0.15,81.89,673.00,0.15,51.51 >7/7/1998,1160,0.15,88.78,653.00,0.15,49.97 >7/8/1998,1360,0.15,104.08,642.00,0.15,49.13 >7/9/1998,1190,0.15,91.07,660.00,0.15,50.51 >7/10/1998,1140,0.15,87.24,681.00,0.15,52.12 >7/11/1998,1380,0.15,105.61,663.00,0.15,50.74 >7/12/1998,1550,0.15,118.62,638.00,0.15,48.83 >7/13/1998,1020,0.15,78.06,640.00,0.15,48.98 >7/14/1998,912,0.15,69.80,655.00,0.15,50.13 >7/15/1998,995,0.15,76.15,636.00,0.15,48.67 >7/16/1998,955,0.15,73.09,641.00,0.15,49.06 >7/17/1998,924,0.15,70.71,635.00,0.15,48.60 >7/18/1998,961,0.15,73.55,663.00,0.15,50.74 >7/19/1998,824,0.15,63.06,695.00,0.15,53.19 >7/20/1998,656,0.15,50.20,768.00,0.15,58.78 >7/21/1998,596,0.15,45.61,746.00,0.15,57.09 >7/22/1998,535,0.15,40.94,777.00,0.15,59.46 >7/23/1998,579,0.15,44.31,763.00,0.15,58.39 >7/24/1998,938,0.15,71.79,719.00,0.15,55.03 >7/25/1998,993,0.15,75.99,704.00,0.15,53.88 >7/26/1998,1220,0.15,93.37,711.00,0.15,54.41 >7/27/1998,1360,0.15,104.08,681.00,0.15,52.12 >7/28/1998,1200,0.15,91.84,697.00,0.15,53.34 >7/29/1998,1340,0.15,102.55,630.00,0.15,48.21 >7/30/1998,3200,0.15,244.90,602.00,0.15,46.07 >7/31/1998,2850,0.15,218.11,628.00,0.15,48.06 >8/1/1998,2570,0.15,196.68,684.00,0.15,52.35 >8/2/1998,1880,0.15,143.88,710.00,0.15,54.34 >8/3/1998,1900,0.15,145.41,684.00,0.15,52.35 >8/4/1998,2450,0.15,187.50,756.00,0.15,57.86 >8/5/1998,2760,0.15,211.22,717.00,0.15,54.87 >8/6/1998,1320,0.15,101.02,837.00,0.15,64.06 >8/7/1998,1030,0.15,78.83,934.00,0.15,71.48 >8/8/1998,1080,0.15,82.65,883.00,0.15,67.58 >8/9/1998,744,0.15,56.94,1010.00,0.15,77.30 >8/10/1998,1250,0.15,95.66,910.00,0.15,69.64 >8/11/1998,1360,0.15,104.08,927.00,0.15,70.94 >8/12/1998,1670,0.15,127.81,889.00,0.15,68.04 >8/13/1998,1210,0.15,92.60,1010.00,0.15,77.30 >8/14/1998,668,0.15,51.12,1010.00,0.15,77.30 >8/15/1998,1180,0.15,90.31,911.00,0.15,69.72 >8/16/1998,1450,0.15,110.97,871.00,0.15,66.66 >8/17/1998,1350,0.15,103.32,843.00,0.15,64.52 >8/18/1998,1260,0.15,96.43,853.00,0.15,65.28 >8/19/1998,936,0.15,71.63,897.00,0.15,68.65 >8/20/1998,672,0.15,51.43,1000.00,0.15,76.53 >8/21/1998,714,0.15,54.64,982.00,0.15,75.15 >8/22/1998,771,0.15,59.01,974.00,0.15,74.54 >8/23/1998,598,0.15,45.77,1000.00,0.15,76.53 >8/24/1998,488,0.15,37.35,NA,0.15,NA >8/25/1998,528,0.15,40.41,NA,0.15,NA >8/26/1998,812,0.15,62.14,936.00,0.15,71.63 >8/27/1998,720,0.15,55.10,993.00,0.15,75.99 >8/28/1998,653,0.15,49.97,944.00,0.15,72.24 >8/29/1998,796,0.15,60.92,892.00,0.15,68.27 >8/30/1998,689,0.15,52.73,901.00,0.15,68.95 >8/31/1998,511,0.15,39.11,1020.00,0.15,78.06 >9/1/1998,410,0.15,31.38,1150.00,0.15,88.01 >9/2/1998,374,0.15,28.62,1180.00,0.15,90.31 >9/3/1998,444,0.15,33.98,1170.00,0.15,89.54 >9/4/1998,473,0.15,36.20,1150.00,0.15,88.01 >9/5/1998,727,0.15,55.64,951.00,0.15,72.78 >9/6/1998,1130,0.15,86.48,735.00,0.15,56.25 >9/7/1998,1090,0.15,83.42,737.00,0.15,56.40 >9/8/1998,1020,0.15,78.06,773.00,0.15,59.16 >9/9/1998,916,0.15,70.10,793.00,0.15,60.69 >9/10/1998,859,0.15,65.74,820.00,0.15,62.76 >9/11/1998,595,0.15,45.54,900.00,0.15,68.88 >9/12/1998,458,0.15,35.05,1060.00,0.15,81.12 >9/13/1998,429,0.15,32.83,1160.00,0.15,88.78 >9/14/1998,418,0.15,31.99,1110.00,0.15,84.95 >9/15/1998,493,0.15,37.73,1150.00,0.15,88.01 >9/16/1998,438,0.15,33.52,1170.00,0.15,89.54 >9/17/1998,406,0.15,31.07,1150.00,0.15,88.01 >9/18/1998,397,0.15,30.38,1140.00,0.15,87.24 >9/19/1998,429,0.15,32.83,1110.00,0.15,84.95 >9/20/1998,450,0.15,34.44,1080.00,0.15,82.65 >9/21/1998,449,0.15,34.36,1060.00,0.15,81.12 >9/22/1998,450,0.15,34.44,1090.00,0.15,83.42 >9/23/1998,478,0.15,36.58,1060.00,0.15,81.12 >9/24/1998,531,0.15,40.64,1030.00,0.15,78.83 >9/25/1998,573,0.15,43.85,999.00,0.15,76.45 >9/26/1998,533,0.15,40.79,1040.00,0.15,79.59 >9/27/1998,564,0.15,43.16,1020.00,0.15,78.06 >9/28/1998,434,0.15,33.21,1130.00,0.15,86.48 >9/29/1998,399,0.15,30.54,1180.00,0.15,90.31 >9/30/1998,359,0.15,27.47,1230.00,0.15,94.13"),header=T) >closeAllConnections() >a[,1] <- transform(a$date,as.Date(a[,1],"%m/%d/%Y")) > >#convert cfs to cfd >Cat.Dam.ConvertQ <- function(Q) (Q * 86400) >#convert SC to TDS using locally regressed data (and do unit >conversion) >Cat.Dam.ConvertSC <- function(SC) ((0.8652 * SC - 145.43) * >(28.3168/1000000/907.185)) > ># estimated annul load, omits missing days >sum(Cat.Dam.ConvertQ(a$Q) * Cat.Dam.Convert(a$SC), na.rm=TRUE) ># 565239.3 > ># 10 realizations for the first day >Cat.Dam.ConvertQ(rnorm(10,a$Q[1],a$Qsd[1])) * >Cat.Dam.ConvertSC(rnorm(10,a$SC[1],a$SCsd[1])) > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.