Dan D
2015-Sep-06 00:47 UTC
[R] [Bayesian Methods] Riemann Sums for Posterior expected loss
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.