tests/testthat/test-fitPoisGlm-output.R

context("Fast fitting a Poisson glm")
y = rpois(20, 2)
x = rnorm(20)
offs = log(runif(20,1,2))
test_that("fitGlmPois does the same as glm",{
    expect_equivalent(fitPoisGlm(y, x, 2, offs)$coef,
                    glm(y~x+I(x^2), family = "poisson", offset = offs)$coef,
                    tolerance = 1e-5)
  expect_equivalent(fitPoisGlm(y, x, 3, offs)$coef,
                    glm(y~x+I(x^2)+I(x^3), family = "poisson", offset = offs)$coef,
                    tolerance = 1e-5)
          })

Try the SPsimSeq package in your browser

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

SPsimSeq documentation built on Nov. 8, 2020, 5:09 p.m.