This function test the null model against the alternative model. In this class, the test is a F-test computed using stats::anova. Derived classes may have their own test procedures.
Arguments
- dat
Data frame. A data frame containing all variables needed by the
null_formula
andalt_formula
.- null_formula
Formula. Formula for fitting the null model. Default is
null_formula = self$null_formula
.- alt_formula
Formula. Formula for fitting the alternative model. Default is
alt_formula = self$alt_formula
.
Examples
# Instantiate
x <- rand_uniform()
e <- rand_normal()
test <- vi_model(prm = list(x = x, e = e),
prm_type = list(x = "r", e = "r"),
formula = y ~ 1 + x + x^2 + e,
null_formula = y ~ x,
alt_formula = y ~ x + I(x^2))
dat <- test$gen(100000)
test$test(dat)
#> $name
#> [1] "F-test"
#>
#> $statistic
#> [1] 518.7168
#>
#> $p_value
#> [1] 1.577532e-114
#>
test$test(dat, alt_formula = y ~ x + I(x^3))
#> $name
#> [1] "F-test"
#>
#> $statistic
#> [1] 515.8307
#>
#> $p_value
#> [1] 6.647544e-114
#>