[R] Add a density line to a cumulative histogram - second try

Jochen1980 info at jochen-bauer.net
Thu Jul 14 11:03:55 CEST 2011


Hi list,

this is my second try for first post on this list (I tried to post via email
and nothing appeared in my email-inbox, so now I try to use the
nabble-web-interface) - I hope that you will only have to read one post in
your inbox! Okay, my question ...

I was able to plot a histogram and add the density()-line to this plot.
I was able to plot a cumulative form of this histogram.
Yet, I was not able to add the density line to this cumulative histogram.

You can watch a picture of the histograms here:
http://www.jochen-bauer.net/downloads/histo-cumulative-density.png

Source:

# Histogramm
histo <- hist( hgd$V1, freq=FALSE )

# Dichte-Schätzer-Funktion reinzeichnen
denspoints <- density( hgd$V1 )
lines( denspoints, col="GREEN", lwd=2 )

# Kumulative Verteilung relativer Häufigkeiten
relcum <- cumsum( histo$counts ) / sum(histo$counts)
barplot( relcum, names.arg=round( histo$mids, 2), col="green",
ylab="Wahrscheinlichkeit")

# Kumulative Dichtefunktion ?

Thanks in advance - Jochen

--
View this message in context: http://r.789695.n4.nabble.com/Add-a-density-line-to-a-cumulative-histogram-second-try-tp3666969p3666969.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list