0

I have a 2d pdf function, it's a bivariate normal distribution,

enter image description here

I plot it angle-wisely, to compare with the original data that I get. That is, I turn (x,y) into (r, theta), and then do some integration. This could be done very easily with Scipy.integrate

# Let f be the pdf
x_vals = np.arange(0, max_speed, 0.5)
y_vals_ =[integrate.nquad(f, 
                          [[x_val-0.5, x_val+0.5],[angle_radian-incre_radian/2, angle_radian+incre_radian/2]]) 
          for x_val in x_vals]

And I can compare pdf with original dataset enter image description here

The problem, is that density plot is not enough, I also want to make a q-q plot. But, since the pdf is a result of integration, is it possible to do it with Scipy?

I have no idea about it. Maybe a possible solution is resort to Sympy. Since the parameters of bivariate pdf is all known, we can generate the correspoding angle-wise pdf.

ZK Zhao
  • 19,885
  • 47
  • 132
  • 206
  • 1
    Could you explain what a q-q plot is? – David Zwicker Mar 01 '16 at 01:25
  • https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot – maxymoo Mar 01 '16 at 02:45
  • Possible duplicate of [Quantile-Quantile Plot using SciPy](http://stackoverflow.com/questions/13865596/quantile-quantile-plot-using-scipy) – maxymoo Mar 01 '16 at 02:53
  • have you looked at http://stackoverflow.com/questions/13865596/quantile-quantile-plot-using-scipy – maxymoo Mar 01 '16 at 02:54
  • you will have to implement your distribution as class with a `ppf` method – maxymoo Mar 01 '16 at 02:54
  • @maxymoo, I don't really understand that example. There is not `pdf` there, just data. But what if I have a `pdf`? – ZK Zhao Mar 01 '16 at 03:34
  • 1
    so in the example they are comparing their samples with the normal distribution (`"norm"`). but you want to compare to your custom pdf, which you will have to implement as a class that has a `ppf` method – maxymoo Mar 01 '16 at 03:44

0 Answers0