How do you define your own distributions in R? If I have a distribution that looks something like this:
P(D=0)=2/4, P(D=1)=1/4, P(D=2)=1/4
How do I turn that into a distribution I can work with?
In the end, I want to be able to use these and do things involving cdfs, icdfs and pmfs. Like find the probability of 1 through a cdf type thing. And I also need to find out how to graph things. But I was going to ask in smaller steps and try to figure things out in between.
If you just need to generate random variates from the distribution, this should suffice:
For something more fancy, try out the distr package. In addition to random number generation, it’ll get you the density, distribution, and quantile functions associated with your distribution: