Question: Generating Samples from a New Probability Distribution.

I want to do a Monte Carlo study with the following probability distribution:

P(X=x):=(x-1)*q^(x-2)*(p^2+(2*(1-p-q))*p)+binomial(x-1, x-3)*q^(x-3)*((1-p-q)^3+(1-p-q)^2*p);

with x = 2. 3, ... infinity and parameters p and q with 0 < p+q < 1. For the Monte Carlo study I ave to generate samples with specified values of p and q. For this I have yo do something similar to:

use Statistics in T:=[1/2,0,0,0,0,0,1/2];

d:=Distribution(ProbabilityTable(T));

R:=RandomVariable(d);

Sample(R,10);

end use;

How is the code when I have the above P(X=x) instead of T?

 

 

Please Wait...