I want to generate 1000
samples from a distribution in python:
p(x1, ..., xn) = p(x1)p(x2|x1)(x3|x2)...p(xn|xn-1)
where xn
can take 0
or 1
where p(x1=1) = 0.75
, p(x_n = 1|x_n-1 = 1)=0.75
and p(x_n = 0|x_n-1 = 0)=0.75
and then count the number of samples out of the 1000 samples that has x2=1
, so as to get rough approximation of the p(x2=1)
Had it been a normal distribution
, I would have used numpy.random.normal(mean, covariance, no of samples)
How do I implement it?