inst/doc/custom-pred-and-model-functions.R

## -----------------------------------------------------------------------------
glmmPQL_modelfun <- function(formula = NULL, data = NULL, random = NULL,
                             family = NULL) {
  fit <- glmmPQL(fixed = formula, data = data, random = random, family = family)
  return(fit)
}

## ---- eval = FALSE------------------------------------------------------------
#  rf_predfun <- function(object = NULL, newdata = NULL, type = NULL) {
#    pred <- predict(object = object, newdata = newdata, type = type)
#    pred <- pred[, 2]
#  }

## -----------------------------------------------------------------------------
svm_predfun <- function(object = NULL, newdata = NULL, probability = NULL) {
  pred <- predict(object, newdata = newdata, probability = TRUE)
  pred <- attr(pred, "probabilities")[, 2]
}

Try the sperrorest package in your browser

Any scripts or data that you put into this service are public.

sperrorest documentation built on Oct. 16, 2022, 5:05 p.m.