R

# Types of Continuous Probability Distribution?

In the last article, we have discussed about continuous probability distribution, today in this article we will discuss the types of continuous probability distribution.

Do you know how many types of continuous distribution are? If you don’t know then, don’t worry we will discuss here.

Types:

1. Normal distribution
2. Gamma distribution
3. Exponential distribution
4. Beta distribution
5. Cauchy distribution
6. Log-normal distribution
7. Logistic distribution
8. Log-logistic distribution
9. Weibull distribution
10. Uniform distribution
11. Multivariate normal distribution

Let’s discuss something about types of Continuous probability distribution.

#### Normal Distribution:

This distribution is central to the theory of parametric statistics. Consider the following
simple exponential function:

`y=exp(|−x|)^m`

As the value of m increases, the function becomes more like a step function. Let’s see the graphs as m increase in R

Lets look into the graph

` `

Where m=2, is the basis of an extremely important and famous probability density function. Once it has been scaled, so that the integral (the area under the curve from −∞ to +∞) is unity, this is the normal distribution.

When the distribution has mean 0 (zero) and standard deviation is 1 the equation becomes:

`f(z)= (1/ √2π)*exp(−z²/2)`

#### The Gamma distribution:

The gamma distribution is useful for describing a wide range of processes where the data are positively skew (i.e. non-normal, with a long tail on the right). It is a two-parameter distribution,
where the parameters are traditionally known as shape and rate. Its density function is:

`f(x) = (1/βα⌈(α))*x(α−1)*exp(−x/β)`

where:

• α is the shape parameter
• 1/β is the rate parameter (β as scale parameter).

Special cases of the gamma distribution are the exponential (α=1) and chi-squared (α=ν/2, β=2).

To see the effect of the shape parameter on the probability density, we can plot the gamma distribution for different values of shape and rate over the range 0.01 to 4:

```x<-seq(0.01,4,.01)
par(mfrow=c(2,2))
y<-dgamma(x,.5,.5)
plot(x,y,type="l")
y<-dgamma(x,.8,.8)
plot(x,y,type="l")
y<-dgamma(x,2,2)
plot(x,y,type="l")
y<-dgamma(x,10,10)
plot(x,y,type="l")```

Here is the graphs Note:

•  α<1 produces monotonic declining functions.
• α>1 produces humped curves that pass through the origin.

Formula to remember:

• The mean of the distribution is αβ
• The variance is (αβ)²,
• The skewness is 2/√α,
• The kurtosis is 6/α.

Thus, for the exponential distribution we have a mean of α, a variance of β², a skewness of 2 and a kurtosis of 6.

For the chi-squared distribution we have a mean of ν, a variance of 2ν, a skewness of 2√(2/ν) and a kurtosis of 12/ν.

```1/β= mean/variance
shape= (1/β)*mean```

We can now answer questions like this: what value is 95% quantile expected from a gamma distribution with mean =2 and variance =3? This implies that rate is 2/3 and shape is 4/3.

`qgamma(0.95,2/3,4/3)`

Here is the R console output An important use of the gamma distribution is in describing continuous measurement data that are not normally distributed.

#### The Exponential distribution:

This is a one-parameter distribution that is a special case of the gamma distribution. Much used in survival analysis. Its density function is given below

`f(t)= exp(−t/μ)/μ`

where both μ and t>0.

#### The beta distribution:

This has two positive constants, a and b, and x is bounded 0≤x≤1:

`f(x) =[⌈(a+b)/⌈a*⌈b]*[x^(a−1)](1−x)^(b−1)`

In R we generate a family of density functions like this:

```x<-seq(0,1,0.01)
fx<-dbeta(x,2,3)
plot(x,fx,type="l")
fx<-dbeta(x,0.5,2)
plot(x,fx,type="l")
fx<-dbeta(x,2,0.5)
plot(x,fx,type="l")
fx<-dbeta(x,0.5,0.5)
plot(x,fx,type="l")```

Here is the plot The important point is whether the parameters are greater or less than 1.

• When both are greater than 1 we get an n-shaped curve which becomes more skew as b>a (top left).
• If 0<a<1 and b>1 then the density is negative (top right),
• while for a>1 and 0<b<1 the density is positive (bottom left).
• The function is U-shaped when both a and b are positive fractions.
• If a=b=1, then we obtain the uniform distribution on [0,1].

Here are 20 random numbers from the beta distribution with shape parameters 2 and 3:

`rbeta(20,2,3)`

Here is the R console output #### Cauchy distribution:

This is a long-tailed two-parameter distribution, characterized by a location parameter a and a scale parameter b. It is real-valued, symmetric about a (which is also its median), and is a curiosity in that it has long enough tails that the expectation does not exist indeed, it has no moments at all (it often appears in counter-examples in maths books). The harmonic mean of a variable with positive density at 0 is typically distributed as Cauchy, and the Cauchy distribution also appears in the theory of Brownian motion (e.g. random walks).
The general form of the distribution is

`f(x)= 1/[πb(1+((x−a)/b)²)]`

for −∞<x<∞.

There is also a one-parameter version, with a = 0 and b = 1, which is known as the standard Cauchy distribution and is the same as Student’s t distribution with one degree of freedom:

`f(x)= 1/[π(1+x²)]`

for −∞<x<∞.

```par(mfrow=c(1,2))
plot(-200:200,dcauchy(-200:200,0,10),type="l",ylab="p(x)",xlab="x")
plot(-200:200,dcauchy(-200:200,0,50),type="l",ylab="p(x)",xlab="x")

```

Here is the plot: Note the very long, fat tail of the Cauchy distribution. The first density function has
scale =10 and the second plot has scale = 50; both have location = 0.

#### The log normal distribution:

The lognormal distribution takes values on the positive real line. If the logarithm of a lognormal deviate is taken, the result is a normal deviate. Applications for the lognormal include the distribution of particle sizes in aggregates, flood flows, concentrations of air contaminants, and failure times. The hazard function of the lognormal is increasing for small values and then decreasing. A mixture of heterogeneous items that
individually have monotone hazards can create such a hazard function.

Density, cumulative probability, quantiles and random generation for the lognormal distribution
employ the function dlnorm like this:

`dlnorm(x, meanlog=0, sdlog=1)`

R console output: The log normal distribution has:

• Mean: exp((μ+σ²)/2)
• Variance: (exp(σ²)-1)* exp(2μ+σ²)
• Skewness: (exp(σ²)+2)√(exp(σ²)-1)
• kurtosis: exp(4σ²)+2*exp(3σ²)+3*exp(2σ²)-6
```par(mfrow=c(1,1))
plot(seq(0,10,0.05),dlnorm(seq(0,10,0.05)), type="l",xlab="x",ylab="LogNormal f(x)")```

Lets have look to the plot here The extremely long tail and exaggerated positive skew are characteristic of the log normal
distribution. Logarithmic transformation followed by analysis with normal errors is often
appropriate for data.

#### The Logistic distribution:

The logistic is the canonical link function in generalized linear models with binomial errors and is described in detail in Chapter 16 on the analysis of proportion data. The cumulative probability is a symmetrical S-shaped distribution that is bounded above by 1 and below by 0. There are two ways of writing the cumulative probability equation:

`p(x)=exp(a+b*x)/1+exp(a+b*x)`

and

`p(x) = 1/1+βexp(−αx)`

Let’s draw graph of logistic function and normal function

```par(mfrow=c(1,2))
plot(seq(-5,5,0.02),dlogis(seq(-5,5,.02)), type="l",ylab="Logistic f(x)")
plot(seq(-5,5,0.02),dnorm(seq(-5,5,.02)), type="l",ylab="Normal f(x)")```

Here is plot, lets have look into it Here, the logistic density function dlogis (left) is compared with an equivalent normal density function dnorm (right) using the default mean 0(zero) and standard deviation 1 in both cases.

Note:

• The much fatter tails of the logistic (still substantial probability at±4 standard deviations.
• Also the difference in the scales of the two y axes (0.25 for the logistic, 0.4 for the normal).

#### The log-logistic distribution:

The log-logistic is a very flexible four-parameter model for describing growth or decay processes:

`y=a+b[exp(c(log(x)−d))/1+exp(c(log(x)−d))]`

Here are two cases.

The first is a negative sigmoid with c=−159 and a=−14:

```x<-seq(0.1,1,0.01)
y<- -1.4+2.1*(exp(-1.59*log(x)-1.53)/(1+exp(-1.59*log(x)-1.53)))
plot(log(x),y,type="l", main="c = -1.59")```

For the second we have c=159 and a=01:

```y<-0.1+2.1*(exp(1.59*log(x)-1.53)/(1+exp(1.59*log(x)-1.53)))
plot(log(x),y,type="l",main="c = -1.59")```

Here is the plot, lets have look Remaining distribution types will discuss in next article.

Please mention your doubts or questions in the comments or shoot me an email @ irrfankhann29@gmail.com