Load calculations: error approximations

David Fox has written a very useful article about calculating the uncertainty in estimates of sediment and nutrient loads.

A standard expression for the variance of a variable is:

Mean of the square minus the square of the mean

In this case:

\mathrm{Var[L]} = E[L^2] - (E[L])^2

Where L is the load and E is the expectation.

Fox (2005) derives expressions for the required expectations based on the assumption that flow and concentration is described by the bivariate lognormal distribution.

E[L] = \exp{ \{ (\mu_C +\mu_Q) +\dfrac{1}{2(1-\rho^2) } \left( (\rho \sigma_Q+ \sigma_C)^2 + (\rho \sigma_C + \sigma_Q)^2 - 2 \rho(\rho \sigma_Q + \sigma_C)(\rho \sigma_C + \sigma_Q) \right) \}}

E[L^2] = \exp{ \{ 2(\mu_C +\mu_Q) +\dfrac{2}{(1-\rho^2)} \left( (\rho \sigma_Q + \sigma_C)^2 + (\rho \sigma_C + \sigma_Q)^2 - 2\rho(\rho\sigma_Q + \sigma_C)(\rho \sigma_C + \sigma_Q) \right ) \} }

An R function to calculate these values is as follows:

# mQ = mean log(flow)
# mC = mean log(concentration)
# sQ = standard deviation log(flow)
# sC = standard deviation log(concentration)
# r = correlation between log(flow) and log(concentration)

Var_L = function(mQ, mC, sQ, sC, r){
  EL = exp(  (mC + mQ) + (1/(2*(1-r^2))) * ((r*sQ + sC)^2 + (r*sC + sQ)^2 - 2*r*(r*sQ + sC)*(r*sC + sQ))) 
  EL2 = exp( 2*(mC + mQ) + (2/(1-r^2)) * ((r*sQ + sC)^2 + (r*sC + sQ)^2 - 2*r*(r*sQ + sC)*(r*sC + sQ)))
  EL2 - (EL)^2

Sample calculation

Fox (2005) provides data for a sample calculation, we can use this data to test the functions to calculate these expectations.

Parameter log(flow) log(concentration)
mean 2.5561 -0.02834
standard deviation 0.6706 0.8008

Correlation between log(flow) and log(concentration) = 0.482.

Using these, values Var[L] = 3132.297 which is consistent with the Fox’s calculations.

Code is available as a gist.


Fox, D. R. (2005) Protocols for the optimal measurement and estimation of nutrient loads: error approximations. Australian Centre for Environmetrics.  University of Melbourne. link

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s