# NOT RUN {
getMethod("fit_model", signature(y = "binary", data = "missing_data.frame"))
setMethod("fit_model", signature(y = "binary", data = "missing_data.frame"), def =
function(y, data, ...) {
to_drop <- data@index[[y@variable_name]]
X <- data@X[, -to_drop]
start <- NULL
# using glm.fit() instead of bayesglm.fit()
out <- glm.fit(X, y@data, weights = data@weights[[y@variable_name]], start = start,
family = y@family, Warning = FALSE, ...)
out$x <- X
class(out) <- c("glm", "lm") # not "bayesglm" class anymore
return(out)
})
# }
# NOT RUN {
if(!exists("imputations", env = .GlobalEnv)) {
imputations <- mi:::imputations # cached from example("mi-package")
}
imputations <- mi(imputations) # will use new fit_model() method for binary variables
# }
Run the code above in your browser using DataLab