GOF_model: Convenience function for creating a GOF-test for statistical...

Description Usage Arguments Value Examples

View source: R/GOF_model.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()
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()

bootGOF documentation built on June 24, 2021, 9:12 a.m.