jlm | R Documentation |
Fit a (mixed-effects) regression model in Julia
jlm(formula, data, family = "gaussian", contrasts = jl_contrasts(data), ...)
jlmer(
formula,
data,
family = NULL,
contrasts = jl_contrasts(data),
...,
fit = TRUE,
optsum = list(),
progress = interactive()
)
formula |
A formula written in Julia syntax. Can be a string or a language object. |
data |
A data frame |
family |
A distribution family |
contrasts |
A Julia dictionary of contrasts
Inferred from |
... |
Additional arguments to the |
fit |
Whether to fit the model. If |
optsum |
A list of values to set for the optimizer. See |
progress |
Whether to print model fitting progress. Defaults to |
A julia model object of class jlme
jlme_setup(restart = TRUE)
# Fixed effects models
lm(mpg ~ hp, mtcars)
jlm(mpg ~ hp, mtcars)
# Auto-handling of contrasts
x <- mtcars
x$cyl_helm <- factor(x$cyl)
contrasts(x$cyl_helm) <- contr.helmert(3)
colnames(contrasts(x$cyl_helm)) <- c("4vs6", "4&6vs8")
lm(mpg ~ cyl_helm, x)
jlm(mpg ~ cyl_helm, x)
# Mixed effects models
library(lme4)
glmer(r2 ~ Anger + Gender + (1 | id), VerbAgg, family = "binomial")
jlmer(r2 ~ Anger + Gender + (1 | id), VerbAgg, family = "binomial")
# Set optimizer options via `optsum`
jlmer(
r2 ~ Anger + Gender + (1 | id), VerbAgg, family = "binomial",
optsum = list(
optimizer = jl(":LN_NELDERMEAD"),
maxfeval = 10L
)
)
stop_julia()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.