pastas.stats.metrics.pearsonr ============================= .. py:function:: pastas.stats.metrics.pearsonr(obs: pandas.Series, sim: pandas.Series, missing: str = 'drop', weighted: bool = False, max_gap: int = 30) -> float Compute the (weighted) Pearson correlation (r). :param obs: The Series with the observed values. :type obs: pandas.Series :param sim: The Series with the simulated values. :type sim: pandas.Series :param missing: string with the rule to deal with missing values in the observed series. Only "drop" is supported now. :type missing: str, optional :param weighted: Weight the values by the normalized time step to account for irregular time series. Default is False. :type weighted: bool, optional :param max_gap: maximum allowed gap period in days to use for the computation of the weights. All time steps larger than max_gap are replace with the max_gap value. Default value is 30 days. :type max_gap: int, optional .. rubric:: Notes The Pearson correlation (r) is computed as follows: .. math:: r = \frac{\sum_{i=1}^{N}w_i (y_{o,i} - \bar{y_o})(y_{s,i} - \bar{ y_s})} {\sqrt{\sum_{i=1}^{N} w_i(y_{o,i}-\bar{y_o})^2 \sum_{i=1}^{N}w_i( y_{s,i} -\bar{y_s})^2}} Where :math:`y_o` is observed time series, :math:`y_s` the simulated time series, and :math:`N` the number of observations in the observed time series. .. !! processed by numpydoc !!