Search code examples
rmeanvariancepearson-correlationhydrogof

How to calculate RMSE on different time scale


I have 18 years daily simulated and observed data and i can calculate the RMSE using this code;

sqrt( mean( (df$simulated-df$observed)^2 , na.rm = TRUE ) )

But i have to calculate RMSE on different time series whole time period, Yearly, monthly, weekly and on seasonal time scale. Moreover, i would like to perform correlation coefficient, variance, bias and mean and put all result in one file.

Any help will be appreciated.


Solution

  • You should checkout hydroTSM and hydroGOF packages. They should have everything you're looking for

    Example:

        # Getting the new numeric goodness-of-fit measures
        gof(sim = Simulated, obs = Observed)
    
        # Plot 'obs' vs 'sim' for the daily,
        # monthly and annual time series 
        ggof(sim = Simulated, obs = Observed, ylab = "Q (ft3/day)",
             ftype = "dma", FUN = mean)
    

    Daily, Monthly and Annual timescale simulation vs observation

        ggof(sim = Sim, obs = Obs, ylab = "Q (ft3/day)",
             ftype = "seasonal", FUN = mean)
    

    Seasonal simulation vs observation