diff --git a/R/generalizedlinearmodel.R b/R/generalizedlinearmodel.R index b927b82..c069bec 100644 --- a/R/generalizedlinearmodel.R +++ b/R/generalizedlinearmodel.R @@ -102,14 +102,14 @@ GeneralizedLinearModelInternal <- function(jaspResults, dataset = NULL, options, limits.min = 0, limits.max = Inf, exitAnalysisIfErrors = TRUE) - + if (length(options$factors) != 0) .hasErrors(dataset, type = "factorLevels", factorLevels.target = options$factors, factorLevels.amount = '< 2', exitAnalysisIfErrors = TRUE) - + if (options[["family"]] == "bernoulli") { if (length(levels(dataset[, options[["dependent"]]])) != 2) @@ -117,6 +117,9 @@ GeneralizedLinearModelInternal <- function(jaspResults, dataset = NULL, options, } else if (options[["family"]] == "binomial") { + if (any(dataset[, options[["weights"]]] == 0)) + .quitAnalysis(gettext("The Binomial family requires the weights variable (i.e. total number of trials) to be non-zero.")) + if (any(dataset[, options[["dependent"]]] < 0) || any(dataset[, options[["dependent"]]] > 1)) .quitAnalysis(gettext("The Binomial family requires the dependent variable (i.e. proportion of successes) to be between 0 and 1 (inclusive).")) @@ -477,14 +480,14 @@ GeneralizedLinearModelInternal <- function(jaspResults, dataset = NULL, options, .glmOutlierTable(jaspResults, dataset, options, ready, position = 8, residType = "standardized deviance") .glmOutlierTable(jaspResults, dataset, options, ready, position = 8, residType = "studentized deviance") - .glmInfluenceTable(jaspResults[["diagnosticsContainer"]], + .glmInfluenceTable(jaspResults[["diagnosticsContainer"]], jaspResults[["glmModels"]][["object"]][["fullModel"]], dataset, options, ready, position = 9) - - .regressionExportResiduals(jaspResults, + + .regressionExportResiduals(jaspResults, jaspResults[["glmModels"]][["object"]][["fullModel"]], dataset, options, ready) - + .glmMulticolliTable(jaspResults, dataset, options, ready, position = 10) return()