0

I have two random variables, x is beta-distributed on the interval [2, 6] and y is uniformly distributed on the interval [0, 1]. For every x I would like to find y such that CDF_x(x) = CDF_x(y) and plot the graph. In other words I would like to get CDF_y_inverse(CDF_x(x)).

So far I have the following code which only plots the pdf of x.

import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from scipy.stats import beta, uniform

a, b = 2, 5
fig, ax = plt.subplots(1, 1)
x = np.linspace(2+4*beta.ppf(0, a, b), 2+4*beta.ppf(1, a, b), 1000)

ax.plot(x, beta.pdf((x-2)/4, a, b), lw=2, color='green', alpha=0.5, label='beta pdf')
plt.show()

Edit: Assume instead of uniform distribution y has truncated normal distribution, otherwise the problem is trivial.

Anna Ignashkina
  • 467
  • 4
  • 16
  • 2
    If `y` is uniformly distributed over [0,1] isn't its inverse-CDF just given by a linear function (actually just `y` itself)? – rwp May 06 '18 at 17:49
  • Actually you are right, the problem becomes trivial. Let me edit and put another distribution – Anna Ignashkina May 07 '18 at 09:06

0 Answers0