I would like to draw a Gama distribution in R but Im confused since it has different notations.
Mine is in the form:
$ theta^alpha x^{alpha-1}e^{-theta x} / Gamma(alpha) $
Let's say for example that $alpha = 5$
Is this the correct way to represent it?:
curve(dgamma(x, scale=1, shape=5),from=0, to=100, main="Gamma distribution")
shape is $alpha$ , im not sure what scale is or what the 'x' does.
Thank you
Best Answer
Following the standard notation you should define the scale parameter as $1/theta$.
Of course in this case it makes no difference because $theta = 1$ but in general when you write the pdf of the gamma distribution the way you did, $theta$ is called rate paramenter and not scale parameter.
This is also made clear in the R documentation for the function:
dgamma
About x insted .. "what x does" is nothing.
x represents the point where you evaluate the pdf.
If you have a sample from a gamma distribution all $x_1,x_2,…,x_n$ are your sample points.
Similar Posts:
- Solved – Gamma parameterization and how to randomly generate $sigma$’s for use in `rnorm(n, $mu$, $sigma$)`
- Solved – MLE of $f(x;alpha,theta)=frac{e^{-x/theta}}{theta^{alpha}Gamma(alpha)}x^{alpha-1}$
- Solved – Sampling from an Inverse Gamma distribution
- Solved – how to draw 100 numbers following exponential distribution (erlang) in python by having k and CV and mean exponential distribution
- Solved – Fitting gamma distribution – loc parameter relation to alpha and beta