VI_MODEL-cash-fit: Test the null model against the alternative model

VI_MODEL$fitR Documentation

Test the null model against the alternative model

Description

This function fit a linear model by using stats::lm.

Arguments

dat

Data frame. A data frame containing all variables needed by the formula.

formula

Formula. Formula for fitting the model. Default is formula = self$null_formula.

...

Arguments passed to stats::lm.

Value

A fitted linear model.

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))

test$fit(test$gen(100000))

test$fit(test$gen(100000), formula = y ~ x + I(x^2))

TengMCing/visage documentation built on Aug. 28, 2024, 3:27 p.m.