gamlj_glm | R Documentation |
Generalized Linear Model with options to estimate logistic, probit, ordinal, multinomial and custum link function models. Provides options to estimate posthoc, simple effects and slopes, plots of main effects and interaction. Model comparison is also an option.
gamlj_glm(
formula = NULL,
data,
model_type = "linear",
dep = NULL,
factors = NULL,
covs = NULL,
offset = NULL,
model_terms = NULL,
fixed_intercept = TRUE,
nested_intercept = NULL,
custom_family = "gaussian",
custom_link = "identity",
nested_terms = NULL,
omnibus = "LRT",
estimates_ci = FALSE,
ci_method = "wald",
boot_r = 1000,
ci_width = 95,
contrasts = NULL,
show_contrastnames = TRUE,
show_contrastcodes = FALSE,
vcov = FALSE,
plot_x = NULL,
plot_z = NULL,
plot_by = NULL,
plot_raw = FALSE,
plot_yscale = FALSE,
plot_xoriginal = FALSE,
plot_black = FALSE,
plot_around = "ci",
emmeans = NULL,
posthoc = NULL,
simple_x = NULL,
simple_mods = NULL,
simple_interactions = FALSE,
covs_conditioning = "mean_sd",
ccm_value = 1,
ccp_value = 25,
covs_scale_labels = "labels",
adjust = list("bonf"),
covs_scale = NULL,
expb_ci = TRUE,
es = list("expb"),
propodds_test = FALSE,
plot_scale = "response"
)
formula |
(optional) the formula of the model compatible with glm. If not passed,
model terms should be defined as a list in |
data |
the data as a data.frame |
model_type |
define the type of model (link function and distribution combination) required.
It can be |
dep |
a string naming the dependent variable from |
factors |
a vector of strings naming the fixed factors from
|
covs |
a vector of strings naming the covariates from |
offset |
a vector of strings naming the offset variables. |
model_terms |
a list of character vectors describing fixed effects
terms. Not needed if |
fixed_intercept |
|
nested_intercept |
|
custom_family |
Distribution family for the custom model, accepts
|
custom_link |
Distribution family for the |
nested_terms |
a list of character vectors describing effects terms for nested model. It can be passed as right-hand formula. |
omnibus |
Whether the omnibus test for the model should be |
estimates_ci |
|
ci_method |
The method used to compute the confidence intervals. 'wald' uses the Wald method to compute standard errors and confidence intervals. 'profile' computes Profile Likelihood Based Confidence Interval, in which the bounds are chosen based on the percentiles of the chi-square distribution around the maximum likelihood estimate. 'quantile' performs a non-parametric boostrap, with 'boot_r' repetitions, and compute the CI based on the percentiles of the boostrap distribution. 'bcai' implements the bias-corrected bootstrap method. |
boot_r |
a number bootstrap repetitions. |
ci_width |
a number between 50 and 99.9 (default: 95) specifying the confidence interval width for the plots. |
contrasts |
a named vector of the form |
show_contrastnames |
|
show_contrastcodes |
|
vcov |
|
plot_x |
a string naming the variable placed on the horizontal axis of the plot |
plot_z |
a string naming the variable represented as separate lines in the plot |
plot_by |
a list of variables defining the levels at which a separate plot should be produced. |
plot_raw |
|
plot_yscale |
|
plot_xoriginal |
|
plot_black |
|
plot_around |
|
emmeans |
a rhs formula with the terms specifying the marginal means
to estimate (of the form |
posthoc |
a rhs formula with the terms specifying the table to apply
the comparisons (of the form |
simple_x |
The variable for which the simple effects (slopes) are computed |
simple_mods |
the variable that provides the levels at which the simple effects are computed |
simple_interactions |
should simple Interactions be computed |
covs_conditioning |
|
ccm_value |
how many st.deviations around the means used to condition
simple effects and plots. Used if |
ccp_value |
offsett (number of percentiles) around the median used to
condition simple effects and plots. Used if
|
covs_scale_labels |
how the levels of a continuous moderator should
appear in tables and plots: |
adjust |
one or more of |
covs_scale |
a named vector of the form |
expb_ci |
|
es |
Effect size indices. |
propodds_test |
Test parallel lines assumptions in cumulative link model (ordinal regression) |
plot_scale |
Chi-squared computation method. |
A results object containing:
results$model | The underlying estimated model | ||||
results$info | a table | ||||
results$main$r2 | a table of R | ||||
results$main$fit | a table | ||||
results$main$anova | a table of ANOVA results | ||||
results$main$coefficients | a table | ||||
results$main$vcov | a table | ||||
results$main$contrastCodeTables | an array of contrast coefficients tables | ||||
results$main$marginals | a table | ||||
results$main$relativerisk | a table | ||||
results$main$paralleltest | a table | ||||
results$posthoc | an array of post-hoc tables | ||||
results$simpleEffects$anova | a table of ANOVA for simple effects | ||||
results$simpleEffects$coefficients | a table | ||||
results$simpleInteractions | an array of simple interactions tables | ||||
results$emmeans | an array of predicted means tables | ||||
results$mainPlots | an array of results plots | ||||
results$plotnotes | a html | ||||
results$predicted | an output | ||||
results$residuals | an output | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$info$asDF
as.data.frame(results$info)
data <- emmeans::neuralgia
GAMLj3::gamlj_glm(formula = Pain ~ Duration,
data = data,
model_type = "logistic"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.