Skip to content

Implement sampling from a long-format density fit #5

@osofr

Description

@osofr
  • sample_value() will not work when using pool = TRUE.
  • The approach needs to somehow replicate the functionality in
    for (k_i in seq_along(private$PsAsW.models)) {
    sampleA_newcat <- private$PsAsW.models[[k_i]]$sampleA(newdata = newdata, ...)
    if (k_i == 1L) sampleA_mat[, k_i] <- sampleA_newcat
    # carry forward all previously sampled 1's (degenerate ones a bin a chosen for the first time)
    if (k_i > 1) {
    # if you succeeded at the previous bin, your 1L is carried through till the end:
    sampleA_mat[(sampleA_mat[, k_i - 1] == 1L), k_i] <- 1L
    # if you haven't succeeded at the previous bin, you get a chance to succeed at this category:
    sampleA_mat[(sampleA_mat[, k_i - 1] == 0L), k_i] <- sampleA_newcat[(sampleA_mat[, k_i - 1] == 0L)]
    }
    }
    but based on a single (pooled) model fit for all bin hazards.
  • This needs to be done directly inside BinOutModel$sampleA. One potential approach is to re-create a loop over nbins, inside the loop mutate newdata with a new bin indicator, then keep call predict for the same fit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions