convertToPDFe: Convert to pdfe

View source: R/convertToPDFe.R

convertToPDFeR Documentation

Convert to pdfe

Description

Converts an estimated probability density to a pdfe object type for plotting and analysis utilities within the PDFEstimator package.

Usage

convertToPDFe(sample, x, pdf)

Arguments

sample

original data sample estimated

x

estimated points

pdf

estimated probability density for each value in x

Details

The plotting functionality available in the PDFEstimator package requires a pdfe object type, generated by the estimatePDF() function. If an alternative estimation method is used, convertToPDFe() will convert it to a pdfe object type. The data sample and the x,y values of the alternative estimate must be provided.

Value

pdfe

a pdfe object type.

Author(s)

Jenny Farmer, Donald Jacobs

References

Farmer, J. and D. Jacobs (2018). "High throughput nonparametric probability density estimation." PLoS One 13(5): e0196937.

See Also

estimatePDF, plot.PDFe, lines.PDFe, summary.PDFe, print.PDFe

Examples

#Estimates a gamma distribution with 1000 sample points using the density() function 
# and converts it to a pdfe object for advanced visual analysis.

sampleSize = 1000
sample = rgamma(sampleSize, shape = 1)
kde = density(sample)
kdeTOpdfe = convertToPDFe(sample, kde$x, kde$y)
plot(kdeTOpdfe, plotPDF = FALSE, plotSQR = TRUE, plotShading = TRUE, showOutlierPercent = 95)

PDFEstimator documentation built on Aug. 24, 2023, 9:07 a.m.