Skip to content

Commit

Permalink
all R code fix weibull zero bounding
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Oct 8, 2024
1 parent 4bd6069 commit 7ec24c9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/primary_censored_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ primary_censored_cdf.pcens_pweibull_dunif <- function(

g <- function(t) {
# Use the lower incomplete gamma function
t <- pmax(t, 0)
scaled_t <- (t * inv_scale)^shape
vapply(scaled_t, function(x) {
pracma::gammainc(1 + inv_shape, x)["lowinc"]
Expand All @@ -300,12 +299,14 @@ primary_censored_cdf.pcens_pweibull_dunif <- function(
# Process non-zero cases only if there are any
if (!all(zero_cases)) {
non_zero_q <- q[!zero_cases]
q_pwindow <- pmax(non_zero_q + pwindow, 0)
non_zero_q <- pmax(non_zero_q, 0)

# Compute necessary survival and distribution functions
pweibull_q <- partial_pweibull(non_zero_q)
pweibull_q_pwindow <- partial_pweibull(non_zero_q + pwindow)
pweibull_q_pwindow <- partial_pweibull(q_pwindow)
g_q <- g(non_zero_q)
g_q_pwindow <- g(non_zero_q + pwindow)
g_q_pwindow <- g(q_pwindow)

Q_T <- 1 - pweibull_q_pwindow
Delta_g <- (g_q_pwindow - g_q)
Expand Down

0 comments on commit 7ec24c9

Please sign in to comment.