Skip to content

Commit

Permalink
lintr, accuracy of result
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 20, 2024
1 parent b3c0409 commit a864be5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test-get_variance.R
Expand Up @@ -3,12 +3,12 @@ skip_if_not_installed("lme4")
data(sleepstudy, package = "lme4")
data("Penicillin", package = "lme4")
set.seed(12345)
sleepstudy$grp <- sample(1:5, size = 180, replace = TRUE)
sleepstudy$grp <- sample.int(5, size = 180, replace = TRUE)
sleepstudy$subgrp <- NA
for (i in 1:5) {
filter_group <- sleepstudy$grp == i
sleepstudy$subgrp[filter_group] <-
sample(1:30, size = sum(filter_group), replace = TRUE)
sample.int(30, size = sum(filter_group), replace = TRUE)
}

study_data <<- sleepstudy
Expand Down Expand Up @@ -286,7 +286,7 @@ test_that("get_variance-cat_random_slope", {

data(sleepstudy, package = "lme4")
set.seed(123)
sleepstudy$Months <- sample(1:4, nrow(sleepstudy), TRUE)
sleepstudy$Months <- sample.int(4, nrow(sleepstudy), TRUE)
study_data3 <<- sleepstudy

m2 <- lme4::lmer(Reaction ~ Days + (0 + Days | Subject), data = study_data3)
Expand Down Expand Up @@ -369,5 +369,5 @@ test_that("fixed effects variance for rank-deficient models, #765", {
)
})
out <- get_variance_fixed(mod_TMB)
expect_equal(out, 627.03661, tolerance = 1e-4, ignore_attr = TRUE)
expect_equal(out, 627.04511567, tolerance = 1e-4, ignore_attr = TRUE)
})

0 comments on commit a864be5

Please sign in to comment.