Ogive Graph in R

Ogive Graph in R, An ogive is a graph that displays the proportion of data values in a dataset that is above or below a particular value.

The following ogive graph in R is created using the instructions in this tutorial:

Ogive Graph in R

For instance, make an Ogive graph in R.

Let’s first define a dataset with 20 values:

put up a dataset

data <- c(5, 6, 7, 8, 9, 12, 14, 16, 16, 17, 20, 22, 25, 30, 34, 35, 38, 41, 43, 45)

Next, let’s make a straightforward ogive graph in R using the graph.freq() and ogive.freq() functions from the agricolae package:

library(agricolae)

Let’s define values to plot

value_bins <- graph.freq(data, plot=FALSE)
values <- ogive.freq(value_bins, frame=FALSE)

Let’s create an ogive chart

plot(values, xlab='Values', ylab='Relative Cumulative Frequency',
main='Ogive Chart', col='steelblue', type='b', pch=19, las=1, bty='l')

The y-axis displays the relative cumulative frequency of values that fall below the levels given on the x-axis while the x-axis displays values from the dataset.

Predictive Modeling and Data Science – Data Science Tutorials

The following describes how to interpret some of the plot() function’s more enigmatic arguments:

type=’b’: Plot both lines and points
pch=19: Fill in the circles in the plot
las=1: Make labels perpendicular to axis
bty=’l’: Only show the border on the bottom and left sides of the plot

We can view the actual values in the plot by printing the values created from the ogive.freq() function:

Now we can view the values in ogive

values
   x  RCF
1  5 0.00
2 13 0.30
3 21 0.55
4 29 0.65
5 37 0.80
6 45 1.00
7 53 1.00

Here’s how to interpret the values:

0% of all values in the dataset were less than or equal to 5.

30% of all values in the dataset were less than or equal to 13.

55% of all values in the dataset were less than or equal to 21.

65% of all values in the dataset were less than or equal to 29.

And so on.

Learn Hadoop for Data Science – Data Science Tutorials

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

12 − twelve =