unit 4
unit 4
package. These functions allow you to generate random numbers from specific distributions,
calculate probability density or mass functions, cumulative distribution functions, and quantiles.
Here are some commonly used probability distributions and their corresponding functions in R:
In R, a normal distribution represents a symmetric bell-shaped curve where most values cluster
around the mean, with fewer values further away. It's commonly used for modeling real-world
data due to its versatility and widespread occurrence in natural phenomena.
- `rnorm(n, mean, sd)`: Generates n random numbers from a normal distribution with mean
and standard deviation specified.
- `dnorm(x, mean, sd)`: Computes the probability density at x for a normal distribution with
mean and standard deviation specified.
- `pnorm(q, mean, sd)`: Calculates the cumulative probability up to q for a normal distribution
with mean and standard deviation specified.
- `qnorm(p, mean, sd)`: Calculates the quantile corresponding to the cumulative probability p
for a normal distribution with mean and standard deviation specified.
Pgm:-
.In R, the binomial distribution represents the probability of getting a certain number of
successes in a fixed number of independent Bernoulli trials, each with the same probability of
success.
- `rbinom(n, size, prob)`: Generates n random numbers from a binomial distribution with
number of trials (size) and probability of success (prob) specified.
- `dbinom(x, size, prob)`: Computes the probability mass function at x for a binomial
distribution with number of trials (size) and probability of success (prob) specified.
- `qbinom(p, size, prob)`: Calculates the quantile corresponding to the cumulative probability p
for a binomial distribution with number of trials (size) and probability of success (prob)
specified.
Pgm:-
- `rpois(n, lambda)`: Generates n random numbers from a Poisson distribution with mean
(lambda) specified.
- `dpois(x, lambda)`: Computes the probability mass function at x for a Poisson distribution
with mean (lambda) specified.
- `qpois(p, lambda)`: Calculates the quantile corresponding to the cumulative probability p for
a Poisson distribution with mean (lambda) specified.
Pgm:-
Data visualization libraries and tools are good R has poor data visualization than python.
in R language