Fit a Gazepoint Growth Curve Analysis mixed model
Source:R/fit_gazepoint_gca.R
fit_gazepoint_gca.RdFit a Growth Curve Analysis (GCA) mixed model to prepared pupil time-course data. The function first attempts a random-intercept plus random-time-slopes model and, if the model fails or is singular, falls back to a random-intercept model.
Usage
fit_gazepoint_gca(
data,
outcome_col = "gca_pupil",
subject_col = "subject",
condition_col = "condition",
time_terms = NULL,
degree = NULL,
weights_col = "gca_weight",
use_weights = TRUE,
random_slopes = TRUE,
fallback_on_singular = TRUE,
REML = FALSE,
optimizer = "bobyqa",
maxfun = 2e+05,
drop_missing = TRUE
)Arguments
- data
A data frame created by
prepare_gazepoint_gca_data().- outcome_col
Name of the GCA outcome column.
- subject_col
Name of the subject column.
- condition_col
Name of the condition column.
- time_terms
Optional character vector of polynomial time-term columns. If
NULL, terms namedtime_poly_1,time_poly_2, ... are detected.- degree
Optional number of polynomial terms to use. If supplied and
time_terms = NULL, the function usestime_poly_1throughtime_poly_degree.- weights_col
Optional weights column. Use
NULLfor unweighted models.- use_weights
Logical. If
TRUE, usesweights_colwhen available.- random_slopes
Logical. If
TRUE, first attempts random slopes for all polynomial time terms.- fallback_on_singular
Logical. If
TRUE, falls back to a random-intercept model when the random-slope model is singular.- REML
Logical passed to
lme4::lmer().- optimizer
Optimizer passed to
lme4::lmerControl().- maxfun
Maximum optimizer function evaluations.
- drop_missing
Logical. If
TRUE, rows with missing model variables are removed before fitting.