[R] Plotting Bi-Gamma Distribution

Gundala Viswanath gundalav at gmail.com
Tue Jul 1 17:14:17 CEST 2008

Hi all,

I've tried to plot a vector which has two peaks in the density.
This link shows the figure.


The red line is normal curve and green line is gamma curve.
Notice that red line can correctly fit the histogram that has two peaks
(i.e. red curve also has two peaks).

But the gamma curve there only has one curve.

Is there a way I can fit the gamma function such that it also
yields two peaks?

Below is my code that generate the graph:

    dgexp <- density(gexp.arr)
    gexp.ymax <- max(dgexp$y)

    # Histograms
    gehist <- hist(gexp.arr,
                 main=paste(genm,"-",desc, ", Mean=",ge_mean, ", SD=",ge_sd, ",
                 Krt=",ge_kurt, ", AIC=",aic, ", BIC=",bic, sep=""),
                more = TRUE,
                xlab = "Exp Level",
                ylim = c(0, gexp.ymax),

    # Normal Curve
    lines(density(gexp.arr), col = "red",lwd = 3)

    # Gamma Curve


- Gundala Viswanath
Jakarta - Indonesia

More information about the R-help mailing list