Posts

Showing posts from February, 2025

Performing montecarlo simulation of regression coefficients

Steps: Random Sampling: Randomly select 100 pairs of discharge ( Q ) and suspended sediment concentration ( C ) from the dataset. Convert these values to their logarithmic forms: log(Q) and log(C) . Compute the Slope (b) of the Regression Line: Calculate the covariance between log(Q) and log(C). Calculate the variance of log(Q). Compute the slope as: b = Cov ( log ⁡ Q , log ⁡ C ) Var ( log ⁡ Q ) b = \frac{\text{Cov}(\log Q, \log C)}{\text{Var}(\log Q)} b = Var ( log Q ) Cov ( log Q , log C ) ​ Compute the Intercept (logA) of the Regression Line: Compute the mean of log(C) and log(Q). Calculate the intercept using the equation: log ⁡ A = Mean ( log ⁡ C ) − ( b × Mean ( log ⁡ Q ) ) \log A = \text{Mean}(\log C) - (b \times \text{Mean}(\log Q)) log A = Mean ( log C ) − ( b × Mean ( log Q )) Compute the Coefficient of Determination ( R 2 R^2 R 2 ): Compute the Pearson correlation coefficient r r r between log(Q) and log(C): r = Cov ( log ⁡ Q , log ⁡ C ) σ log ⁡ Q ⋅ σ log ⁡ C r = \fra...