[R] Plotting Confidence Intervals into a density plot

David Winsemius dwinsemius at comcast.net
Fri Dec 2 01:24:26 CET 2016


> On Dec 1, 2016, at 12:10 PM, Elysa Mitova <elysa.mitova at gmail.com> wrote:
> 
> Hi,
> 
> I am desperately looking for a way to plot confidence intervals into a
> density plot of only one variable (not a scatter plot etc.)
> 
> Have you any advice how to do this?
> 
> I've only found manual ways to do with "abline", but this is a rather
> bothersome method and only works with ggplot (and not ggplot2).

This makes it appear that you expect this to be done in ggplot2 automagically. I suspect you must instead first find the right approach to construction of those upper and lower bounds before plotting. It's not clear what methods you expect to be needed. Your desperation is not a guide. Perhaps trying a bit of searching?

install.packages("sos")
library(sos)
findFn("confidence intervals density estimates")


Delivers quite a few results. Then searching on the text within that webpage you find 


208	2	27	54	nprobust	kdrobust	2016-11-14 16:41:50	27	Kernel Density Estimation with Robust Confidence Intervals
209	2	27	54	nprobust	lprobust	2016-11-14 16:41:50	27	Local-Polynomial Estimation with Robust Confidence Intervals

Is that what you seek?

> 
> Thank you!
> 
> 	[[alternative HTML version deleted]]
I know you just subscribed, so now is the time to read the Posing Guide.

== 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list