tests/testthat/test_ridgereg_ref_class.R

context("ridgereg")
data("iris")
library (MASS)

test_that("Coefficients of lm.ridge and ridgereg are equal", {
  ridgereg_ex <-  ridgereg(formula = Petal.Length ~ Sepal.Width + Sepal.Length, data = iris, lambda = 0)
  linmod_ridge <- lm.ridge(formula = Petal.Length ~ Sepal.Width + Sepal.Length, data = iris)
  
  expect_equal(round(as.vector(linmod_ridge$coef),2),round(as.vector(ridgereg_ex$coef()),2))    
})
afuergut/lib7af documentation built on May 28, 2019, 4:42 p.m.