Convert Proabbility density function to CDF

I have a Probability Density Function as provided below

ozone = airquality$Ozone
density.ozone = density(ozone, na.rm = T)

#kernel density plot ozone
plot(density.ozone, main = 'Kernel Density Estimates of Ozone', 
     xlab = 'Ozone (ppb)', ylab = 'Density', 
     ylim = c(0, max(density.ozone$y, na.rm = T)), lty = 1)

I want to convert it to CDF. For this, I tried

# KDE to CDF
library(spatstat)
f_KDE_CDF=CDF(density.ozone)
plot(f_KDE_CDF)

I want to get a plot with x-axis with real ozone value with y-axis as proability with max of 1.

Try the kde1d package.

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.