tests/testthat/test_for_3rd_problem.R

library(testthat)

context("Test the output of lm_ridge_lambda_best function.")

test_that("Your lm_ridge_lambda_best() function can choose the best lambda.",
{

  data(iris)

  best_lambda_self_defined <- lm_ridge_lambda_best(Sepal.Width~., iris)

  best_lambda_by_glmnet <- glmnet_ridge_lambda_best(Sepal.Width~., iris)

  expect_equivalent(best_lambda_self_defined, best_lambda_by_glmnet,tolerance = 1e-2)
})
Jiachen1027/bis557 documentation built on Oct. 30, 2019, 7:41 p.m.