The “rgeom” Function in R
Package: Base R (no specific package required)
Purpose: Generates random numbers from a geometric distribution.
General Class: Random Number Generation
Required Argument(s):
n: The number of random values to generate.
prob: The probability of success on each trial.
Notable Optional Arguments:
None.
Example:
# Generate 100 random values from a geometric distribution with probability of success 0.2
random_values <- rgeom(n = 100, prob = 0.2)
print(random_values)In this example, the rgeom function is used to generate 100 random values from a geometric distribution with a probability of success of 0.2. The generated values are then printed to the console.