Generating a gamma distribution

Hello, today I worked with generating random gamma distributions with known parameters, therefore, I would like to share my codes and comments regarding to a data generation process of a gamma distribution in R. Gamma distribution is a two-parameter continues probability distribution. The first parameter is called shape parameter and the second parameter is called scales parameter.

The shape parameter is calculated by mu^2/sigma^2 and scale parameter is calculated by sigma^2/mu. Therefore given both parameters, we can generate a random gamma distribution with a known number of people (n).

Here it goes.

gamma.gen <- rgamma(1000, 0.5, scale=0.01)

1000 is the sample size, 0.5 is the shape parameter and .01 is the scale parameter.

The histogram of the distribution looks like:

hist(gamma.gen)

Screen Shot 2017-03-22 at 4.23.57 PM

The distribution is very similar to chi-square distribution, which is actually a special case of the gamma distribution.

Best.

Seyfullah.

 

 

Advertisements
Why I start blogging? WHY?

Why I start blogging? WHY?

Hello world! This is Seyfullah Tingir, a PhD candidate majoring Measurement & Statistics from Florida State University. Here is my short intro why I started writing post in WordPress.

During my long dissertation journey, I would like share my thoughts about what I am researching. I plan to write about the R codes, the projects I am currently involved with, life in Florida, and so on. Actually, I do not have plans 🙂 I have a lot of thoughts such as creating videos for the R or SPSS learners and share them to the world from this window. I hope that once I cumulate enough journals here, I will categorize them appropriately.

I do not have a motto yet, but it would be something like, “I teach you, you teach me!”. Not a good one though but I think learning new things from people is my favorite thing. Therefore, I will write new things that I learn here, and I expect to get feedback and comments to learn more.

Today is March 22, 2017, Wednesday. Hope years later, I would say:

“I am glad, I started writing this fruitful experience that day!”.

Best.

Seyfullah Tingir.