comparison_test_treatment | R Documentation |
For a between-individual comparison, a t-test comparing the melatonin suppression level at a single lux is conducted on two subgroups (untreated and treated) comprising different sets of individuals.
comparison_test_treatment( is_between, lux, n, population_treated_df, is_treated_higher, nreps = 1 )
is_between |
a Boolean indicating whether experiment is within or between type |
lux |
the lux value at which to conduct the comparison |
n |
number of individuals in sample |
population_treated_df |
a virtual population data frame with individual who have been treated and those who have been untreated (where treatment is indicated by a Boolean column named "treated") |
is_treated_higher |
Boolean indicating whether treated group has a higher response |
nreps |
integer indicating number of test replicates (which defaults to 1) |
For a within-individual comparison, a paired t-test comparing the melatonin suppression level at a single lux level for a set of individuals before and after they are treated is conducted.
This function requires based an (ideally large) simulated population of individual dose-response data.
a dataframe where each row corresponds to a test result in a replicate; note that 'result' indicates that the difference was of the correct sign
library(melluxdrc) library(purrr) library(dplyr) # create a population where half are treated; half not n <- 200 population_df <- virtual_treatment_experiment(n, treated_ed50_multiplier=0.5) # carry out a within-study test at 10 lux for 30 people # note that, because the ed50 multiplier for the treated group was # <1, this group should have a higher response is_treated_higher <- TRUE comparison_test_treatment(FALSE, 10, 30, population_df, is_treated_higher)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.