Parameterisation of R::dexp

不羁的心 提交于 2019-12-02 07:48:09

If you look at the function definition for dexp,

R> dexp
function (x, rate = 1, log = FALSE) 
.Call(C_dexp, x, 1/rate, log)

you'll see that dexp calls the C function C_dexp with parameter 1/rate. This is what R::dexp is mirroring. In Rcp, they always use the same parameterisation as R itself does at the C level which may be different than the R level.

That means

R> my_dexp(4.5, 1/2.5, FALSE) - dexp(4.5, 2.5, FALSE)
[1] 0

If you look at the Wikipedia page on the exponential function, you'll see the alternative parameterisation based on the reciprocal of the rate parameter, lambda. In this parameterisation, the parameter beta=1/lambda takes the role of a survival parameter. So the expected duration of survival of the system is beta units of time.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!