| .mcee_fit_nuisance | R Documentation |
Internal workhorse function that fits individual nuisance parameters using various machine learning methods or known constants. Handles the complexity of different learner APIs and provides consistent predictions.
.mcee_fit_nuisance(
config,
data_for_fitting,
data_for_predicting,
lhs_var,
param_name,
data_for_fitting_name
)
config |
Configuration list describing how to fit the nuisance parameter.
Created by
|
data_for_fitting |
Data frame subset used to train the model (e.g., available rows only). |
data_for_predicting |
Data frame on which to generate predictions (usually full data). |
lhs_var |
Character. Column name of the response/outcome variable to model. |
param_name |
Character. Descriptive name for error messages (e.g., "p_t(1|H_t)"). |
data_for_fitting_name |
Character. Description of fitting data for model call display. |
**Supported Methods:**
"glm": Uses stats::glm() with automatic family detection
"lm": Uses stats::lm() (continuous outcomes only)
"gam": Uses mgcv::gam() supporting smooth terms
"rf": Uses randomForest::randomForest()
"ranger": Uses ranger::ranger() (faster random forest)
"sl": Uses SuperLearner::SuperLearner()
**Automatic Family Detection:**
When family=NULL in GLM/GAM configs:
- Binary outcomes (0/1 only): binomial()
- Continuous outcomes: gaussian()
**Known Values:**
If any of known, known_a1, known_a0 is provided, no model
is fitted. Returns constant predictions and a descriptor object.
List with components:
predNumeric vector of length nrow(data_for_predicting)
containing predictions/fitted values.
modelFitted model object (e.g., glm, gam, randomForest)
or a list descriptor for known values.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.