tests/testthat/test_for_2nd_problem.R

library(testthat)

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

test_that("Your lm_ridge_beta() function can return the ridge regression estimators.", {

  data(X,Y)

  fit_lm_ridge <- lm_ridge_beta(X,Y,10)

  fit_glmnet_ridge <- glmnet_beta(X,Y,10)

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