开发者

PHP actuarial-type probability formula

How would I convert the following formula to php to solve for "p":

(1-p)^365=.80

What I'm trying to do is calculate the daily probability of an event based on the annual probability. For example, let's say the likelihood that John Doe is going to die in a particular year is 20%. So what would be the likelihood on any given day of that year? I know the answer for that example scenario is 0.0611165 using the formula above (where .80 is the 80% annual survival probability). What I need is a formula in which I can开发者_JAVA技巧 substitute various annual probabilities and the result would be the corresponding daily probabilities.

Can anyone help?


To solve for p you need to take the 365-th root of both sides, then solve for p.

<?php
  $prob = 0.80;
  $p = 1 - pow($prob, 1/365);
?>


Well you'd take the 365th root of both sides which is equivalent to raising to the 1/365

<?php
    $prob = 0.80;
    $prob = pow($prob, 1/365);

then you'd add 1

    $p = $prob + 1;
    echo $p;
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜