[R] [Bayesian Methods] Riemann Sums for Posterior expected loss

Dan D ddalthorp at usgs.gov
Sun Sep 6 02:47:38 CEST 2015

Does this get you started?

  (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.]


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.

More information about the R-help mailing list