comparison_test | R Documentation |
For a between-individual experiment, a t-test is used to compare the melatonin suppression level at two lux values for two different samples of individuals. This function requires based an (ideally large) simulated population of individual dose-response data.
comparison_test(is_between, lux_1, lux_2, n, population_df, nreps = 1)
is_between |
a Boolean indicating whether experiment is within or between type |
lux_1 |
first measured lux value |
lux_2 |
second measured lux value |
n |
number of individuals in sample |
population_df |
a tibble representing a virtual experiment |
nreps |
integer indicating number of test replicates (which defaults to 1) |
For a within-individual, a paired t-test is used to compare the melatonin suppression level at two lux values for a sample of individuals measured at each of those values. 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) # generate virtual data for 200 individuals population_df <- virtual_experiment(200) # carry out between-individual experiment comparing lux_1=10 with lux_2=30 # for a test sample size of 20 is_between <- TRUE comparison_test(is_between, 10, 30, 20, population_df) # carry out within-individual experiments comparing lux_1=10 with lux_2=30 # for a test sample size of 20 is_between <- FALSE comparison_test(is_between, 10, 30, 20, population_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.