Skip to content

Commit

Permalink
add some zero safety
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Oct 8, 2024
1 parent 462780d commit 8236f57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions R/primary_censored_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ primary_censored_cdf.pcens_pweibull_dunif <- function(
# Use the lower incomplete gamma function
scaled_t <- (t * inv_scale)^shape
vapply(scaled_t, function(x) {
if (x <= 0) {
return(0)
}
pracma::gammainc(x, 1 + inv_shape)["lowinc"]
}, numeric(1))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ real primary_censored_lognormal_uniform_lcdf(data real d, real q, array[] real p
}

/**
* Compute the log of the integral of the Weibull PDF from 0 to t
* Compute the log of the lower incomplete gamma function
*
* This function is used in the analytical solution for the primary censored
* Weibull distribution with uniform primary censoring. It corresponds to the
Expand Down

0 comments on commit 8236f57

Please sign in to comment.