test_that("sparse and dense implementations give equivalent results", {
set.seed(2)
n <- 100
p <- 2
for (family in c("gaussian", "binomial", "poisson")) {
d <- owl:::randomProblem(n, p, 0.5, density = 0.5, response = family)
sparse_x <- d$x
dense_x <- as.matrix(sparse_x)
y <- d$y
beta <- d$beta
sparse_fit <- owl(sparse_x, y, family = family, center = FALSE)
sparse_coefs <- coef(sparse_fit)
dense_fit <- owl(dense_x, y, family = family, center = FALSE)
dense_coefs <- coef(dense_fit)
expect_equal(sparse_coefs, dense_coefs, tol = 1e-4)
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.