Open In App

Plot a Geometric Distribution Graph in R Programming – dgeom() Function

Last Updated : 30 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

dgeom() function in R Programming is used to plot a geometric distribution graph.

Syntax: dgeom(x, prob)

Parameters:

  • prob: prob of the geometric distribution
  • x: x values of the plot

Example 1:




# R program to illustrat
# dgeom function to plot
  
# Specify x-values for dgeom function
x_dgeom <- seq(2, 10, by = 1)    
  
# Apply dgeom function 
y_dgeom <- dgeom(x_dgeom, prob = 0.5)    
  
# Plot dgeom values 
plot(y_dgeom)                                                                         


Output:

Example 2:




# R program to illustrate
# dgeom() function to plot
  
# Specify x-values for dgeom function
x_dgeom <- seq(1, 7, by = 1)    
  
# Apply dgeom function 
y_dgeom <- dgeom(x_dgeom, prob = 0.05)    
  
# Plot dgeom values 
plot(y_dgeom)     


Output:


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads