tests/testthat/test_function.R

context("User supplied functions")

test_that("doFit works for a function", {


    f <- function(yy) lmer(yy ~ x + (1|g), data=simdata)

    ps <- powerSim(fit=f, sim=fm1, test=fixed("x", "z"))
    expect_equal(nrow(ps$errors), 0)

    g <- function(yy, subset) lmer(yy ~ x + (1|g), data=simdata, subset=subset)

    pc <- powerCurve(fit=g, sim=fm1, test=fixed("x", "z"), along="x")
    expect_equal(nrow(pc$errors), 0)
})

Try the simr package in your browser

Any scripts or data that you put into this service are public.

simr documentation built on April 14, 2023, 12:24 a.m.