tests/testthat/test_offset.R

context("Test adding an offset term")
library(mpcmp)

test_that("Test adding an offset term", 
          {
            data("cottonbolls")
            set.seed(1)
            cottonbolls$n_samples <- rpois(nrow(cottonbolls), 5)
            M.bolls <- glm.cmp(nc~ 1+stages:def+stages:def2, offset = log(n_samples),data = cottonbolls)
            expect_equal(M.bolls$offset, log(cottonbolls$n_samples))
          })

Try the mpcmp package in your browser

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

mpcmp documentation built on Oct. 26, 2020, 9:07 a.m.