Fits a random forest model using the ranger package for transition modeling. Uses observation-based weighting and stratified downsampling to handle class imbalance.
Arguments
- data
A data.table containing the did_transition column and predictor columns (prefixed with "id_pred_")
- num.trees
Number of trees to grow in the random forest (default: 100)
- max.depth
Maximum depth of each tree (default: 100)
- ...
Additional arguments passed to
ranger::ranger()
Details
The function:
Uses ranger for efficient random forest implementation
Applies observation-based weights (same approach as grrf_filter)
Uses stratified downsampling via sample.fraction
Returns probability predictions for the positive class
Computes variable importance using impurity measure
Applies butcher::butcher() if available to reduce model size
Default hyperparameters:
num.trees = 500
min.node.size = 1