Find the best numeric split by concentration-index gain
Source:R/best_numeric_split.R
best_numeric_split.RdEvaluate all admissible cutpoints of a numeric predictor and return the split with the largest weighted concentration-index gain.
Usage
best_numeric_split(
x,
y,
wt,
varid,
ctrl,
ci_fun,
return = c("split", "candidate")
)Arguments
- x
A numeric predictor vector.
- y
A two-column numeric matrix whose first column is the socioeconomic ranking variable and whose second column is the health outcome.
- wt
A numeric vector of case weights with the same length as
x.- varid
Integer identifier of the splitting variable, passed to
partykit::partysplit().- ctrl
A list-like control object containing
minbucketandminprob.- ci_fun
A concentration-index scoring function, typically created by
ci_factory().- return
Either
"split"to return only apartykit::partysplit()object, or"candidate"to also return the gain and left-child routing needed by the greedy tree builder.
Value
A partysplit object describing the best admissible binary split, or
NULL if no split is available because all x values are tied or all
candidate splits violate the control constraints.
Details
Candidate cutpoints are formed at midpoints between distinct sorted values of
x. Each candidate is filtered using ctrl$minbucket and ctrl$minprob
before being scored with weighted_ci_gain().