Cache list, containing the last fitted model, data frame and formula
Source:R/zzz_VI_MODEL.R
VI_MODEL-cash-..cache...Rd
A list, will be used if cache = TRUE
while calling the fit
method.
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))
# Turn on cache
test$fit(test$gen(10), cache = TRUE)
#>
#> Call:
#> stats::lm(formula = y ~ x, data = test$gen(10))
#>
#> Coefficients:
#> (Intercept) x
#> 0.5371 2.4550
#>
test$..cache..
#> $dat
#> y x e .resid .fitted
#> 1 2.70041295 0.89184237 0.01318775 -0.4861032 3.1865161
#> 2 0.36658615 0.53451153 -1.45362796 -1.7961332 2.1627193
#> 3 0.14277243 0.01523344 -0.87269307 -0.5321513 0.6749237
#> 4 3.93123433 0.60936551 1.95054251 1.5540492 2.3771852
#> 5 3.59532086 0.98478629 0.64073053 0.1425090 3.4528119
#> 6 4.14476037 0.64215488 2.09024261 1.6736296 2.4711307
#> 7 1.14252524 0.63887879 -0.90451966 -1.3192191 2.4617443
#> 8 1.88783385 0.09722767 0.78115296 0.9779866 0.9098473
#> 9 1.72102519 0.13497229 0.56783538 0.7030349 1.0179902
#> 10 0.04940525 0.11717814 -1.08150361 -0.9176026 0.9670078
#>
#> $formula
#> y ~ x
#>
#> $mod
#>
#> Call:
#> stats::lm(formula = y ~ x, data = test$gen(10))
#>
#> Coefficients:
#> (Intercept) x
#> 0.5371 2.4550
#>
#>