Skip to content

Bug: bcf() overrides user-supplied num_burnin to 10 if propensity_train is NULL #222

@ninjasoul

Description

@ninjasoul

Summary

When calling bcf() with a user-specified num_burnin (e.g., 1000) but leaving propensity_train = NULL (to have it estimated internally), the num_burnin parameter is overridden to 10.

Problem Details

This appears to be caused by a variable scope issue in R/bcf.R.

  1. A user calls bcf(..., num_burnin = 1000, propensity_train = NULL).
  2. The code enters the if (is.null(propensity_train)) block here.
  3. Inside this block, the assignment num_burnin <- 10 is made here.
  4. This assignment overwrites the num_burnin variable for the entire function scope, not just for the internal propensity model.
  5. As a result, the main BCF sampling loop incorrectly uses num_burnin = 10 instead of the user's intended 1000.

Expected Behavior

The user-supplied num_burnin value should be used for the main BCF model's burn-in phase. The num_burnin <- 10 assignment was likely intended to be a local variable (e.g., propensity_burnin) used only for the internal GFR propensity score estimation.

Suggested Fix

Possibly rename the variable at R/bcf.R to a new, local variable (e.g., prop_num_burnin <- 10) and use that new variable for the GFR sampling within that if block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions