integrand=function(xeval,x){ #fuction to be evaluated for integration.. # For example the Gamma distribution.. library(MASS) zz=fitdistr(x, "gamma") xdens = dgamma(xeval, shape=zz$estimate[1], scale=1/zz$estimate[2]) xdens }