# Title : MixedDiagnosticsInterface.R
# Objective : Diagnosis
# Created by: greyhypotheses
# Created on: 07/04/2022
source(file = 'R/nerve/MixedDiagnosticsGraphs.R')
source(file = 'R/nerve/MixedDiagnosticsRE.R')
#'
#' @description ... diagnostics w.r.t. the best of the explored glmer(.) models, and
#' an analysis of the random effects assumptions w.r.t. the best glmer(.)
#' model
#'
#' @param initial: The best model, thus far
#' @param nerve: The data frame of the nerve data set
#'
MixedDiagnosticsInterface <- function (initial, nerve) {
n.trials <- 15
#' Main Diagnostics
#'
diagnostics <- nerve %>%
dplyr::mutate(residual.deviance = residuals(object = initial, type = 'deviance')) %>%
dplyr::mutate(fitted.value = n.trials * fitted.values(object = initial))
MixedDiagnosticsGraphs(diagnostics = diagnostics)
#' The Random Effects
#'
randomeffects <- ranef(object = initial)
# ... there are 60 distinct patients therefore 60 sets of estimates expected
patients <- randomeffects$patient
patients <- rename(patients, 'intercept' = '(Intercept)')
# ... patients grouping
g <- GaussianAssumptionRE(patients = patients)
print(g)
# ... patients grouping
g <- CorrelationAssumptionRE(patients = patients)
print(g)
# ... patients grouping
measures <- MeasuresRE(model = initial)
return(measures)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.