Simplifies the creation of an instance of GOF_model_test, the actual work horse for performing a goodness-of-fit-test.

GOF_model(
  model,
  data,
  nmb_boot_samples,
  simulator_type,
  y_name,
  Rn1_statistic,
  gof_model_resample_class = GOF_model_resample,
  gof_model_test_class = GOF_model_test
)

Arguments

model

of class 'lm' or 'glm'. Caution with MASS::glm.nb, see vignette 'New-Models' for more details.

data

see GOF_model_test

nmb_boot_samples

see GOF_model_test

simulator_type

either "parameteric" or "semi_parameteric_rademacher"

y_name

see GOF_model_test

Rn1_statistic

see GOF_model_test

gof_model_resample_class

no need to change this parameter. Here the class used for resampling the model (GOF_model_resample) is injected. This parameter simply makes it easier to test the convenience function properly.

gof_model_test_class

no need to change this parameter. Here the class used for performing the GOF test (GOF_model_test) is injected. This parameter simply makes it easier to test the convenience function properly.

Value

instance of GOF_model_test

Examples

set.seed(1) N <- 100 X1 <- rnorm(N) X2 <- rnorm(N) d <- data.frame( y = rpois(n = N, lambda = exp(4 + X1 * 2 + X2 * 6)), x1 = X1, x2 = X2) fit <- glm(y ~ x1, data = d, family = poisson()) mt <- GOF_model( model = fit, data = d, nmb_boot_samples = 100, simulator_type = "parametric", y_name = "y", Rn1_statistic = Rn1_KS$new()) mt$get_pvalue()
#> [1] 0
fit <- glm(y ~ x1 + x2, data = d, family = poisson()) mt <- GOF_model( model = fit, data = d, nmb_boot_samples = 100, simulator_type = "parametric", y_name = "y", Rn1_statistic = Rn1_KS$new()) mt$get_pvalue()
#> [1] 0.61