我正在尝试将该glm方法caret::train用于广义线性混合效应模型。我使用以下代码来设置该功能:
`GLMERmod <- list(type="Classification", library="lme4", loop=NULL)
parameters <- data.frame(parameter="parameter", class="character",
label="parameter")
GLMERmod$parameters <- parameters
grid <- function (x, y, len = NULL, search = "grid"){
data.frame(parameter = "none")
}
GLMERmod$grid <- grid
fit <-
function (x, y, wts, param, lev, last, classProbs, ...)
{
dat <- if (is.data.frame(x))
x
else as.data.frame(x)
dat$.outcome <- y
if (length(levels(y)) > 2)
stop("glm models can only use 2-class outcomes")
theDots <- list(...)
if (!any(names(theDots) == "family")) {
theDots$family <- if …Run Code Online (Sandbox Code Playgroud)