# How to determine RSquared using a fitted Probability density function?

I am testing 7 probability density functions for best fit on solar radiation data for the island of Trinidad. One of the statistical parameters i must use for testing best fit is the coefficient of determination ($R^2$). I have used histograms to represent the actual measured data.

For $R^2$ I am using the formula:

$R^2= 1 - \frac{(sum of(MeasuredVals - EstimatedVals))}{(sum of(MeasuredVals - MeanOfMeasuredVals))]}$

I am having difficulty understanding how to determine the Estimated Values that go with the measured values. I am using the MATLAB 'distribution fitter' app and EasyFitXL for fitting. I believe I have to use the inverse cumulative distribution function but I'm not sure how to apply it.

• Welcome to CV. Since you're new here, you may want to take our tour, which has information for new users. Please check your formula, it is not correct (see this wikipedia page). Also, part of the question is not clear. For example, what is the model you are estimating? Apr 5 '17 at 17:47
• Why do you think you have to use $R^2$ to assess this? (Or, I suppose, four years later, why did you think that?)
– Dave
Dec 4 '20 at 16:23

## 1 Answer

For reasons related to the issue you've encountered, $R^2$ doesn't seem like an appropriate way to measure how well a sample agrees with a proposed PDF. Instead, you might look at the likelihood, or the earth mover's distance from the empirical CDF.