let’s start the series of continuous probability distribution, It’s a big topic so we will earn this in parts.

Lets learn the built-in **R functions,** **distribution and parameters** which are used in R for continuous probability distribution.

R has a wide range of built-in probability distributions, for each of which **four functions** are

available:

- the probability density function (which has a
**d**prefix); - the cumulative probability(which has a
**p**prefix); - the quantiles of the distribution (which has a
**q**prefix) and - random numbers generated from the distribution (which has a
**r**prefix).

If we want to calculate cumulative probability we have make ** p** prefixed to the R function[e.g

**]; and for probability density, we have to make**

*pbeta***prefixed to the R function[e.g**

*d**].*

**dbinom**Similary each R function can be prefixed which are shown in below Table

R function |
Distribution |
Parameters |

beta | beta | shape1, shape2 |

binom | binomial | sample size, probability |

cauchy | Cauchy | location, scale |

exp | exponential | rate (optional) |

chisq | chi-squared | degrees of freedom |

f | Fisher’s F | df1, df2 |

gamma | gamma | shape |

geom | geometric | probability |

hyper | hypergeometric | m, n, k |

lnorm | lognormal | mean, standard deviation |

logis | logistic | location, scale |

nbinom | negative | binomial size, probability |

norm | normal | mean, standard deviation |

pois | Poisson | mean |

signrank | Wilcoxon signed rank statistic | sample size n |

t | Student’s t | degrees of freedom |

unif | uniform | minimum, maximum (opt.) |

weibull | Weibull | shape |

wilcox | Wilcoxon rank sum | m, n |

The** cumulative probability function** is a straightforward notion for any value of x, the probability of obtaining a sample value that is less than or equal to x.

curve(pnorm(x),-3,3) arrows(-1,0,-1,pnorm(-1),col="red") arrows(-1,pnorm(-1),-3,pnorm(-1),col="green")

Here is the graph, it look like S-shape

The value of x(−1) leads up to the cumulative probability (red arrow) and the probability

associated with obtaining a value of this size (−1) or smaller is on the y axis (green arrow).

The value on the y axis is 0.158 655 3:

>pnorm(-1)

The **probability density function** is the slope of this curve (its ‘derivative’). You can see at once that the slope is never negative. The slope starts out very shallow up to about x=−2, increases up to a peak (at x = 0 in this example) then gets shallower, and becomes very small indeed above about x=2.

Here is what the density function of the normal (dnorm) looks like:

curve(dnorm(x),-3,3)

Here the curve, it looks like of probability density

For a **discrete random** variable, like the **Poisson or the binomial**, the **probability density**

function is straightforward, it is simply a histogram with the y axis scaled as probabilities

rather than counts, and the discrete values of *x* (0, 1, 2, 3,…) on the horizontal axis(*x*).

But for a continuous random variable, the definition of the probability density function is

more subtle.

It does not have probabilities on the *y* axis, but rather the slope of the cumulative probability function at a given value of *x*.

Categories: R

Sustain the outstanding work !! Lovin’ it! http://thebridaltrunk.com/author/alberthamac/

LikeLike