tests/testthat/test-DGP.R

context("test - DGP")

beta <- c(-0.5, 0.7, -0.9, 1.1)
miData <- DGP(70, 3, beta)
test_that("DGP", {
  expect_equal(length(miData$Z), 210L)
  expect_equal(dim(miData$X), c(210L, 3L))
  expect_equal(length(miData$ID), 210L)
  expect_equal(miData$ID, rep(1L:70L, each = 3))
  expect_true(all(abs(colMeans(miData$X)) < 1e-6))
  expect_true(all(tapply(miData$Z, miData$ID, function(x) all(diff(x) == 0))))
})

Try the milr package in your browser

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

milr documentation built on May 2, 2019, 6:35 a.m.