# Quantifying Uncertainties in OC-SMART Ocean Color Retrievals: A Bayesian Inversion Algorithm
## 3 Methodology for Quantifying Uncertainties  
### Bayesian Inversion  
The Bayesian approach is summarized in this Section [24; 41; 42]. To generate uncertainties for each individual pixel Bayesian inference utilizes measured TOA radiances and _a priori_ data to estimate posterior probability density functions and associated uncertainties. [PERSON] theorem can be expressed as:  
\[P(\mathbf{x}|\mathbf{y})=\frac{P(\mathbf{y}|\mathbf{x})\cdot P(\mathbf{x})}{P( \mathbf{y})}. \tag{1}\]  
Here \(P(\mathbf{x}|\mathbf{y})\) describes the posterior probability density function (pdf) of the state parameters assembled in the vector \(\mathbf{x}\) given the measurements assembled in the vector \(\mathbf{y}\). \(P(\mathbf{y}|\mathbf{x})\) describes \(\mathbf{y}\) if the state were \(\mathbf{x}\), \(P(\mathbf{x})\) is the estimate of the probability of \(\mathbf{x}\) before the \(\mathbf{y}\) data are observed. [PERSON] theorem allows a process to inversion by updating \(P(\mathbf{x})\) with the measurement pdf \(P(\mathbf{y}|\mathbf{x})\) to calculate \(P(\mathbf{x}|\mathbf{y})\). Figure 1: Framework for formulation of the uncertainty estimations applied to OC-SMART. Experimental error is frequently described by a normal distribution [41]. Therefore, for simplicity and convenience, we will assume that each pdf is a Gaussian distribution, which, for an arbitrary vector \(\mathbf{z}\), can be expressed as:  
\[P(\mathbf{z})=\frac{1}{(2\pi)^{1/2}[\mathbf{S}_{z}]^{1/2}}\exp[-\frac{1}{2}( \mathbf{z}-\mathbf{\hat{z}})^{T}\mathbf{S}_{z}^{-1}(\mathbf{z}-\mathbf{\hat{z} })]. \tag{2}\]  
Here, \(\mathbf{\hat{z}}\) is the expected value of \(\mathbf{z}\) and \(\mathbf{S}_{z}\) is the covariance matrix. If the forward model \(\mathbf{F}(\mathbf{x})\) can be linearized, then we have  
\[\mathbf{y}=\mathbf{F}(\mathbf{x})+\mathbf{e}\approx\mathbf{J}\mathbf{x}+ \mathbf{e} \tag{3}\]  
where \(\mathbf{J}\) is the Jacobian matrix [see Equation (11)] and \(\mathbf{e}\) represents random measurement uncertainty. In the linear case, we can obtain an explicit retrieval, such as the expected value, by choosing a suitable state, such as the most probable state determined from the posterior pdf \(P(\mathbf{x}|\mathbf{y})\). We do not expect our problem to be linear, but Equation (3) introduces the Jacobian which will be used in the general non-linear case. Hence, in the non-linear case we proceed as follows. Taking the logarithm of Equation (1) we have:  
\[2\ln P(\mathbf{x}|\mathbf{y})\propto\ln P(\mathbf{y}|\mathbf{x})+\ln P( \mathbf{x}). \tag{4}\]  
Again, if all pdf's are assumed to be Gaussian, then Equation (4) can be written (see Appendix A for a derivation)  
\[\ln[P(\mathbf{x}|\mathbf{y})]\ \propto\ (\mathbf{y}-\mathbf{F}(\mathbf{x}))^{T} \mathbf{S_{e}}^{-1}(\mathbf{y}-\mathbf{F}(\mathbf{x}))+(\mathbf{x}-\mathbf{x _{a}})^{T}\mathbf{S_{a}}^{-1}(\mathbf{x}-\mathbf{x_{a}}) \tag{5}\]  
where \(\mathbf{F}(\mathbf{x})\) is the non-linear forward model, \(\mathbf{S_{e}}\) is the measurement error covariance matrix, and \(\mathbf{S_{a}}\) is the _a priori_ covariance matrix [41; 42]. The right hand side of Equation (5) represents the cost function which must be minimized in order to solve the inverse problem. In the non-linear case an explicit solution is not available. The solution can be determined iteratively using the Gauss-Newton method:  
\[\mathbf{x}_{i+1}=\mathbf{x}_{i}+(\mathbf{J}_{i}^{T}\mathbf{S_{e}}^{-1} \mathbf{J}_{i}+\mathbf{S_{a}}^{-1})^{-1}[\mathbf{J}_{i}^{T}\mathbf{S_{e}}^{- 1}(\mathbf{y}-\mathbf{F}(\mathbf{x}_{i}))-\mathbf{S_{a}}^{-1}(\mathbf{x}_{i}- \mathbf{x_{a}})]. \tag{6}\]  
Upon convergence to the state vector \(\mathbf{x}\), the posterior error covariance matrix becomes:  
\[\mathbf{\hat{S}}(\mathbf{x})=(\mathbf{J}(\mathbf{x})^{T}\mathbf{S_{e}}^{-1} \mathbf{J}(\mathbf{x})+\mathbf{S_{a}}^{-1})^{-1}. \tag{7}\]  
The evaluation of each of these matrices is discussed in the following sections.