Does this get you started? f<-function(t,cx){ (abs(t-cx)*(t >= cx)+10*abs(t-cx)*(t < cx))*dbeta(t,1.05,30) }
integrate(f,lower=0,upper=1,cx=0.4)$val # e.g., for c = 0.4 The "integrate" function integrates over the first parameter. Other parameters can be entered as needed. [Note: I used cx as the parameter name rather than c because 'c' has a special meaning in R.] -Dan -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Methods-Riemann-Sums-for-Posterior-expected-loss-tp4711900p4711901.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.