| bestModel | R Documentation |
Computes Taylor polynomial regression models by evaluating a series of models with increasing number of predictors. It aims to find a consistent model that effectively captures the variance in the data. It draws on the regsubsets function from the leaps package, builds up to 10 models per number of predictors, screens them for model consistency (monotonicity of the mapping between norm score and raw score over the complete age range) and selects the consistent model with the highest R^2. This automatic model selection should usually be accompanied by visual inspection of the percentile plots and assessment of fit statistics. Set R^2 or the number of terms manually to retrieve a more parsimonious model, if desired.
bestModel(
data,
raw = NULL,
R2 = NULL,
k = NULL,
t = NULL,
predictors = NULL,
terms = 0,
weights = NULL,
force.in = NULL,
plot = TRUE,
extensive = TRUE,
averaging = FALSE,
subsampling = FALSE
)
data |
Preprocessed dataset with 'raw' scores, powers, interactions, and usually an explanatory variable (like age). |
raw |
Name of the raw score variable (default: 'raw'). |
R2 |
Adjusted R^2 stopping criterion for model building. |
k |
Power constant influencing model complexity (default: taken from the data preparation, max: 6). |
t |
Age power parameter. If unset, taken from the data preparation (default 3). |
predictors |
List of predictors or regression formula for model selection. Overrides 'k' and can include additional variables. |
terms |
Desired number of terms in the model. |
weights |
Optional case weights. If set to FALSE, default weights (if any) are ignored. |
force.in |
Variables forcibly included in the regression. |
plot |
If TRUE (default), displays a percentile plot of the model and information about the regression object. FALSE turns off plotting and report. |
extensive |
If TRUE (default), screen models for consistency and - if possible - exclude inconsistent ones. |
averaging |
If TRUE (default FALSE), apply BIC-weighted model averaging
across the consistency-screened candidate models instead of selecting a
single model. Requires |
subsampling |
Deprecated and ignored. Use |
The functions rankBySlidingWindow, rankByGroup, bestModel,
computePowers and prepareData are usually not called directly,
but accessed through other functions like cnorm.
Additional functions like plotSubset(model) and cnorm.cv can
aid in model evaluation.
If averaging = TRUE, the final coefficients are not taken from a
single selected model, but computed as a BIC-weighted average across all
consistency-screened candidate models (weights w_j \propto
exp(-\Delta BIC_j / 2)). Since a convex combination of functions that are
all monotone in the same direction is itself monotone, the averaged model is
guaranteed to remain consistent, while reducing model selection variance.
This replaces the deprecated subsampling approach.
The model. Further exploration can be done using
plotSubset(model) and plotPercentiles(data, model).
plotSubset, plotPercentiles, plotPercentileSeries, checkConsistency
Other model:
checkConsistency(),
cnorm.cv(),
derive(),
modelSummary(),
print.cnorm(),
printSubset(),
rangeCheck(),
regressionFunction(),
summary.cnorm(),
weightedAverageModel()
## Not run:
# It is not recommended to directly use this function. Rather use 'cnorm' instead.
normData <- prepareData(elfe)
model <- bestModel(normData)
plotSubset(model)
plotPercentiles(buildCnormObject(normData, model))
# Specifying variables explicitly
preselectedModel <- bestModel(normData, predictors = c("L1", "L3", "L1A3", "A2", "A3"))
print(regressionFunction(preselectedModel))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.