View source: R/check_convergence.R
check_convergence | R Documentation |
Assesses model convergence and provides diagnostics for each exposure (in univariate mode) or for the full model (in multivariable mode), depending on the regression approach used.
check_convergence(
data,
exposures,
outcome,
approach = "logit",
multivariate = FALSE
)
data |
A data frame containing the dataset. |
exposures |
A character vector of predictor variable names.
If |
outcome |
A character string specifying the outcome variable. |
approach |
A character string specifying the regression approach.
One of:
|
multivariate |
Logical. If |
For robpoisson
, predicted probabilities (fitted values) may exceed 1,
which is acceptable when estimating risk ratios but should not be interpreted
as actual probabilities.
This function is useful for identifying convergence issues, especially for
"log-binomial"
models, which often fail to converge .
A data frame summarizing convergence diagnostics, including:
Exposure
Name of the exposure variable.
Model
The regression approach used.
Converged
TRUE
if the model converged successfully;
FALSE
otherwise.
Max.prob
Maximum predicted probability or fitted value in the dataset.
[identify_confounder()], [interaction_models()]
if (requireNamespace("gtregression", quietly = TRUE)) {
data(data_PimaIndiansDiabetes, package = "gtregression")
check_convergence(
data = data_PimaIndiansDiabetes,
exposures = c("age", "bmi"),
outcome = "diabetes",
approach = "logit"
)
check_convergence(
data = data_PimaIndiansDiabetes,
exposures = c("age", "bmi"),
outcome = "diabetes",
approach = "logit",
multivariate = TRUE
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.