emitanaka / edibble

An R-package that encapsulate elements of experimental design for better planning, management, and workflow
https://edibble.emitanaka.org
Other
215 stars 14 forks source link

fill_vars #23

Closed emitanaka closed 1 year ago

emitanaka commented 3 years ago

Fill values for record vars using expected range of values (by default assumes uniform or normal or allow distribution?)

emitanaka commented 3 years ago

maybe call it fill_rcrds or simulate_rcrds

emitanaka commented 3 years ago
start_design() %>% 
  set_trts(treat = c("A", "B", "C")) %>% 
  set_units(unit = 12) %>% 
  allocate_trts(treat ~ unit) %>% 
  randomise_trts() %> %
  set_rcrds(response = unit) %>% 
  expect_rcrds(response = to_be_numeric(with_value(between = c(0, 100))) %>% 
  simulate_rcrds(response = sim_norm(mean = ~30 + treat, sd = 3, 
                                     effects = list(treat = c("A" = 3, "B" = 2, "C" = 0)))
emitanaka commented 3 years ago

fill_rcrds = literally just fill records based on expect_rcrds (with some simple choice of distribution). if not specified then just sample from standard normal. The idea is to just have some numbers or factor levels filled quickly so you can run analysis as demonstration. simulate_rcrd is for more complex case.