Evaluating the hazard function when the CDF is close to 1?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
4
down vote
favorite
I need to evaluate a hazard function $h(t;theta) = dfracf(t;theta)1-F(t;theta)$, where $f$ and $F$ are a pdf and a cdf, respectively, at many values of $t$ (and for several values of the parameter $theta$). In some cases, when I evaluate $F(t;theta)$, it returns the value $1$ for some values of $t$, making $h$ infinite.
For example, in R pweibull(100,1,1)
returns 1
.
Is there any trick to avoid this problem?
- I wasn't sure if I should ask this question on stackoverflow instead, but since the question is related to a function that is widely used in statistics, I thought crossvalidated was a better place as some people may know of a "classical" solution.
r cdf hazard
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
4
down vote
favorite
I need to evaluate a hazard function $h(t;theta) = dfracf(t;theta)1-F(t;theta)$, where $f$ and $F$ are a pdf and a cdf, respectively, at many values of $t$ (and for several values of the parameter $theta$). In some cases, when I evaluate $F(t;theta)$, it returns the value $1$ for some values of $t$, making $h$ infinite.
For example, in R pweibull(100,1,1)
returns 1
.
Is there any trick to avoid this problem?
- I wasn't sure if I should ask this question on stackoverflow instead, but since the question is related to a function that is widely used in statistics, I thought crossvalidated was a better place as some people may know of a "classical" solution.
r cdf hazard
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I need to evaluate a hazard function $h(t;theta) = dfracf(t;theta)1-F(t;theta)$, where $f$ and $F$ are a pdf and a cdf, respectively, at many values of $t$ (and for several values of the parameter $theta$). In some cases, when I evaluate $F(t;theta)$, it returns the value $1$ for some values of $t$, making $h$ infinite.
For example, in R pweibull(100,1,1)
returns 1
.
Is there any trick to avoid this problem?
- I wasn't sure if I should ask this question on stackoverflow instead, but since the question is related to a function that is widely used in statistics, I thought crossvalidated was a better place as some people may know of a "classical" solution.
r cdf hazard
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I need to evaluate a hazard function $h(t;theta) = dfracf(t;theta)1-F(t;theta)$, where $f$ and $F$ are a pdf and a cdf, respectively, at many values of $t$ (and for several values of the parameter $theta$). In some cases, when I evaluate $F(t;theta)$, it returns the value $1$ for some values of $t$, making $h$ infinite.
For example, in R pweibull(100,1,1)
returns 1
.
Is there any trick to avoid this problem?
- I wasn't sure if I should ask this question on stackoverflow instead, but since the question is related to a function that is widely used in statistics, I thought crossvalidated was a better place as some people may know of a "classical" solution.
r cdf hazard
r cdf hazard
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited just now
Ferdi
3,47842151
3,47842151
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 27 mins ago
Hazardous
211
211
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Hazardous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
If the matter is numerical stability, you could look at the log of the hazard function:
$$log(h(t; theta)) = log(f(t;theta)) - log(1-F(t;theta))$$
You could use the log / log.p = TRUE
flag in R for log values and the lower.tail
flag for obtaining $log(1 - F(t;theta))$ values:
dweibull(100,1,1, log = T) # -100
pweibull(100, 1, 1, log.p = TRUE, lower.tail = FALSE) # -100
Which gives you an estimate: $h(t;theta) = exp(-100 + 100) = 1$
Edit: By the way, when you have a $Weibull(1, 1)$ distribution, I believe that this is an $Exponential(1)$, so it has a constant hazard function.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
If the matter is numerical stability, you could look at the log of the hazard function:
$$log(h(t; theta)) = log(f(t;theta)) - log(1-F(t;theta))$$
You could use the log / log.p = TRUE
flag in R for log values and the lower.tail
flag for obtaining $log(1 - F(t;theta))$ values:
dweibull(100,1,1, log = T) # -100
pweibull(100, 1, 1, log.p = TRUE, lower.tail = FALSE) # -100
Which gives you an estimate: $h(t;theta) = exp(-100 + 100) = 1$
Edit: By the way, when you have a $Weibull(1, 1)$ distribution, I believe that this is an $Exponential(1)$, so it has a constant hazard function.
add a comment |Â
up vote
2
down vote
If the matter is numerical stability, you could look at the log of the hazard function:
$$log(h(t; theta)) = log(f(t;theta)) - log(1-F(t;theta))$$
You could use the log / log.p = TRUE
flag in R for log values and the lower.tail
flag for obtaining $log(1 - F(t;theta))$ values:
dweibull(100,1,1, log = T) # -100
pweibull(100, 1, 1, log.p = TRUE, lower.tail = FALSE) # -100
Which gives you an estimate: $h(t;theta) = exp(-100 + 100) = 1$
Edit: By the way, when you have a $Weibull(1, 1)$ distribution, I believe that this is an $Exponential(1)$, so it has a constant hazard function.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
If the matter is numerical stability, you could look at the log of the hazard function:
$$log(h(t; theta)) = log(f(t;theta)) - log(1-F(t;theta))$$
You could use the log / log.p = TRUE
flag in R for log values and the lower.tail
flag for obtaining $log(1 - F(t;theta))$ values:
dweibull(100,1,1, log = T) # -100
pweibull(100, 1, 1, log.p = TRUE, lower.tail = FALSE) # -100
Which gives you an estimate: $h(t;theta) = exp(-100 + 100) = 1$
Edit: By the way, when you have a $Weibull(1, 1)$ distribution, I believe that this is an $Exponential(1)$, so it has a constant hazard function.
If the matter is numerical stability, you could look at the log of the hazard function:
$$log(h(t; theta)) = log(f(t;theta)) - log(1-F(t;theta))$$
You could use the log / log.p = TRUE
flag in R for log values and the lower.tail
flag for obtaining $log(1 - F(t;theta))$ values:
dweibull(100,1,1, log = T) # -100
pweibull(100, 1, 1, log.p = TRUE, lower.tail = FALSE) # -100
Which gives you an estimate: $h(t;theta) = exp(-100 + 100) = 1$
Edit: By the way, when you have a $Weibull(1, 1)$ distribution, I believe that this is an $Exponential(1)$, so it has a constant hazard function.
edited 7 mins ago
answered 13 mins ago


InfProbSciX
44910
44910
add a comment |Â
add a comment |Â
Hazardous is a new contributor. Be nice, and check out our Code of Conduct.
Hazardous is a new contributor. Be nice, and check out our Code of Conduct.
Hazardous is a new contributor. Be nice, and check out our Code of Conduct.
Hazardous is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f371987%2fevaluating-the-hazard-function-when-the-cdf-is-close-to-1%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password