0

I'm still relatively new to R and I'm confused on how I'm supposed to plot gamma My data is distributed ~ Gamma(1000,20)

so my code looks like

curve(dgamma(x, shape = 1000 , scale = 20, log = FALSE))

This results in a straight line being plot. I am pretty sure it has to do with my value of shape being so high. But the only reason it is 1000 is because I thought shape is a paramter equivalent to alpha (so 1000). Am I wrong? Does shape equal something else? Or is my issue somewhere else?

Thank you!

ajdawg
  • 17
  • 1
  • 2
    You need to set the range of the x-axis, e.g. `curve(dgamma(x, shape = 1000 , scale = 20, log = FALSE), from = 0, to = 2000)`. The parameters are explained in the help page `?dgamma`. – Marius Oct 25 '18 at 23:15
  • Its depend on `x`? whats `x`? – SRhm Oct 25 '18 at 23:20
  • @SRhm: In `curve()`, you can write `x` in an expression and `curve` will evaluate the expression, substituting in different `x` values based on the `from` and `to` args. The example code is fine, it doesn't need a separate `x` variable to be defined. – Marius Oct 25 '18 at 23:25
  • @Marius You are right @ajdawg should increase the range like: `curve(dgamma(x, shape = 1000 , scale = 20, log = FALSE), from = 1000, to = 40000)` – SRhm Oct 25 '18 at 23:55

0 Answers0