What is the proper way to compute the r-squared between a binned distribution of observed values and a continuous probability density function? I have circular data -- observations each of which falls between -180 degrees and +180 degrees -- divided into a 15-bin histogram.
I'd like to see how well a continuous PDF -- specifically a mixture of a von Mises distribution and a uniform distribution, with particular parameters -- fits the observed histogram.
And to determine this fit, I'd like to use the r-squared statistic.  I'd like to leave aside the question of whether I should be using r-squared or something else.  My choice of r-squared is based on Zhang & Luck, Nature, 2008 and Zhang & Luck, Psychological Science, 2009, work I'm trying to replicate.  (These papers did exactly what I'm describing I want to do -- compute the r-squared between a 15-bin histogram of circular data and the mixture model.)  But if you'd like to suggest a better method, and can describe it clearly, I'd be happy to try it out.
My question is, how should I compute the r-squared?  Should I bin the continuous function, and then compare the PDF bin heights to the observed bin heights?  Should I take the mean of the PDF over the range spanned by each bin of the observed data?  Should I compare the bin centers to the corresponding points in the continuous function?
 A: You can plot empirical data vs your distribution with fitted parameters. Please see the answer of this link and plot histogram of your original data and smooth histogram of your fitted data as data1 is the original data and data2 is your fitted data using MLE estimates.      
A: When computing the $r^2$ between the histogram and the continuous PDF, one should use the normalized values of the histogram (indicative of frequencies, such that the area of the histogram is 1) and the mean of the PDF in each bin (the integral over the range of each bin, normalized by the width of the bin).  See this webpage for a description of how to obtain a continuous function's mean within a given range.
Note, however, that other statistics may be more appropriate for assessing goodness of fit between the observed distribution and the PDF.  Two suggested in the comments to my question are the $\chi^2$ statistic (thanks, @AdamO) and the Kolmogorov-Smirnov (KS) test.  Zhang and Luck (2008, 2009) calculated these in addition to $r^2$.  Specifically, $r^2$ is inappropriate when the PDF being compared to the data is the uniform function, for the reasons @whuber states in one of his comments.  @NickCox claims in one of his comments that all three of these measures are inappropriate for circular data.  
@NickCox offers the Kuiper statistic as the best measure for testing the goodness of fit in the present scenario (thanks for that!), but claims it is unlikely to be available in software.  This pessimism is unfounded: The KS test is available in the SciPy package for Python as scipy.stats.kstest (see the documentation here), and the results from this function can be used to calculate the Kuiper statistic (see this webpage for the latter statistic's definition).  It appears at least one user of Python has written code that directly calculates the Kuiper statistic.
As most reviewers of scientific papers are unlikely to be satisfied with the use of a single measure of goodness of fit, I recommend using several, perhaps all, of the suggested statistics.  Another option, vaguely alluded to by @NickCox, is to compare the fits of different models with something like the Bayesian Information Criterion (see van den Berg et al. [PNAS, 2012] for an example of its application) or the Akaike Information Criterion (see Fougnie et al. [Nat Commun, 2012]).
A: This is just a very simple test of calibration. By using the binning approach, you need not do any more than calculate the $\chi^2$ fit statistic and be done with it. It is very limited in scope of what it addresses, but you have not indicated whether you're interested in anything else based on your problem description. 
To calculate expected frequencies, you integrate the continuous DF for your referent population distribution model over bounds you've defined by binning. The choice of which values to bin is very important indeed and should not be guided by $p$-values but rather meaningful cut points. The $\chi^2$ statistic is then $\chi^2_{(k-1)} = \sum_{i=1}^k \frac{\left(O_i - E_i\right)^2}{E_i}$ with $k$ being the number of bins.
