Questions tagged [gamma-distribution]

Anything related to the gamma probability distribution, i.e. a continuous probability distribution whose probability density function is connected to the "gamma function". DO NOT USE this tag for questions about the gamma function, use the [gamma-function] tag instead.

Anything related to the gamma probability distribution, i.e. a continuous probability distribution whose probability density function is connected to the gamma function.

If a variable X follows a gamma distribution with shape parameter k>0 and scale parameter θ, then it has probability density function:

enter image description here

It follows that E(X)=kθ and Var(X)=kθ². In some texts, the gamma distribution is parameterized instead by the rate parameter, which is the reciprocal of the scale parameter: β=1/θ.

DO NOT USE this tag for questions about the gamma function, use the tag instead.

See Wikipedia page on the gamma distribution.


Tag Usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

219 questions
0
votes
1 answer

Fit gamma distribution parameters to expectation and probabilty

My problem is the following. I measured a bunch of different physical properties and propagated the methodic and measurement uncertainties all the way to some kind of efficiency ratio. For all my physical properties, a normal distribution seemed to…
SvA
  • 3
  • 2
0
votes
2 answers

How to simulate different sample size for many times and calculate the sum for each sample size

Here is my code : for (p in 1:10){ sample=rgamma(p,p,1)} Here is what I get [1] 1.841629 [1] 2.174076 1.410500 [1] 2.398601 4.674819 2.679830 [1] 2.736786 3.767747 4.546256 3.851677 [1] 4.204808 8.393887 10.312640 2.514957 4.863661 How can I…
0
votes
0 answers

Take random distribution of s in gamma(1, 1) and plot a transformation of x

Let x be a random variable with probability density function (pdf) x ~ Gamma(1, 1). How to plot the pdf of z where z=x^2/(1+sin(x))? This is what I have tried, I am not sure how to get z from x. x = np.linspace (0, 100, 200) y1 = stats.gamma.pdf(x,…
VXL963
  • 41
  • 5
0
votes
2 answers

How would I go about repeating this simulation 1000 times to get a list output from which I can take the mean?

I'm trying to simulate 1000 trials of the following situation to get a mean output of cost. In addition to what's included below, each simulation would need to stop if the totalTime >= 6. I struggle a lot with for loops and simulations so I would…
user16262096
0
votes
1 answer

Implementing Gamma PDF function

I am trying to implement the Gamma PDF function for the integer argument. First I have implemented it with exponential terms but there were overflows, so I tried to compute the log of it, but the log goes to -inf as alpha and beta are increased. Is…
geradism
  • 97
  • 2
  • 14
0
votes
1 answer

R code for sampling from a mixture of normal and exponential components

I am trying to generate a bivariate sample from a mixture of two component distributions viz., normal and gamma distributions. I am using the 'copula' package for that. The code I wrote is as follows- library("copula") mycop =…
0
votes
0 answers

How to set seed for a gamma distribution and how to define it in R?

I need help with gamma distribution in R, I want to choose randomly N samples (N=1200) in different sizes n (n=10, n=100 etc.) from gamma distribution where alpha=4.3 and beta=2.1. I have to set.seed(a) where a is number of four digits, and I have…
data_girl
  • 1
  • 1
0
votes
1 answer

I would like to replace the exponential function with the gamma function in calculating the 95% likelihood based confidence interval in R

I would like to replace the exponential log likelihood explik <- function(x) { sum( dexp(data, 1/x, log=TRUE)) } with the gamma negative log-likelihood gammalike <- function(x) { -sum(dgamma(data, shape=x, scale=2, log=TRUE)) } in the…
Charles
  • 29
  • 5
0
votes
1 answer

Gamma distribution in a GLMM

I am trying to create a GLMM in R. I want to find out how the emergence time of bats depends on different factors. Here I take the time difference between the departure of the respective bat and the sunset of the day as dependent variable (metric).…
0
votes
0 answers

Mean distribution from several gamma distributions

I want to get a mean distribution from several gamma distributions I have fitted on data. What I do is taking all the no, mu, delta paramaters in a np array. Then I average all the values for each parameter and plot the resulting function. For each…
0
votes
1 answer

Fixing y-axis labels on R graph with several distribution functions

I am trying to graph a few different gamma distribution functions in R with the standard R commands--no packages. As you can see here, the y-axis is being redone for each function I graph. Is there a way that I can have all 7 of my functions go…
325
  • 594
  • 8
  • 21
0
votes
1 answer

Gamma density function

I'm trying different ways to plot for my data. I have a vector ld <- seq(0.001,0.4,0.005) , and parameters for the gamma distribution are 25 (shape) and 240 (rate). My first way for plotting was: pr <- dgamma(ld, 25,240) plot(ld,pr,type="b") I also…
YYM17
  • 341
  • 1
  • 10
0
votes
1 answer

Fitting distributions with R

Good afternoon. I have a vector 'a' containing 16000 values. I get the descriptive statistics with the help of the following: library(pastecs) library(timeDate) stat.desc(a) skewness(a) kurtosis(a) Especially skewness=-0.5012, kurtosis=420.8073…
Maxim
  • 99
  • 1
  • 4
  • 11
0
votes
2 answers

Compute Renewal Process in R for Gamma distribution

I am trying to find the sum for the following formula in R for alpha = 2. I wrote the following command. How to sum from n = 1 to infinity. Please provide me a hint. Thank you in advance! integrand <- function(x) { dgamma(x, shape = n * 2, rate =…
score324
  • 687
  • 10
  • 18
0
votes
2 answers

How to get the equations for Probability distribution function and Cumulative density function of a gamma distribution in scipy (Python)

Just as we can write the CDF and PDF of a random variable X, following a normal distribution, with its parameters - std and mean using scipy in the following manner: from numpy import sqrt, pi, exp mean, std = 295, 250 # defining Cumulative…
Vishal Anand
  • 178
  • 2
  • 10