How to get density estimates for specific x values in R

by Petter Lindgren   Last Updated August 16, 2018 13:19 PM

I'm using ggplot and geom_denisty in R to estimate density function for different factors:

gg2 + geom_density(aes(fill=factor(wb)), bw=0.002 , alpha=0.8) + xlim(c(-0.03, 0.03)) + labs(title="Density estimation plot", x="x")

resulting in the following plot:

density estimation for factor w and b separately

Now I like to get the likelihoods (the estimated densities) for a specific x-value for each density function. Actually, I then like to compare the likelihoods to create a likelihood ratio. How do I do that? Where do I found the numbers from which the plot has been produced?



Related Questions


Optimize a likelihood in a semiparametric setting

Updated February 27, 2017 16:19 PM



Mean Integrated Square Error

Updated May 24, 2018 09:19 AM

accuracy conditional on feature values

Updated April 25, 2018 23:19 PM