ratio_test {ecotox} | R Documentation |
Ratio test
Description
Calculates a ratio test to compare two LC or LT values from two separate probit or logit models. This function is based on the ratio test developed in Wheeler et al. 2006. 10.1897/05-320R.1 which has been suggested as a replacement to the common method of comparing confidence intervals to determine differences.
Usage
ratio_test(model_1, model_2, percentage = NULL,
type = NULL, compare = NULL, log_base = NULL, log_x = TRUE,
obj_type = NULL, conf_type = NULL)
Arguments
model_1 |
first model used in the ratio test. Should be an object of either a probit or logit model created using the |
model_2 |
second model used in the ratio test. Should be an object of either a
probit or logit model created using the |
percentage |
either a single value or a vector for given LC or LT percentage desired to compare.
Percentage is the same value used for the argument |
type |
Link type needs to be specified to either |
compare |
Supply a character string to be used in the output letting the user know what models the LCs or LTs are being compared. Default output is "Model 1 - Model 2". See example. |
log_base |
default is |
log_x |
default is |
obj_type |
default is |
conf_type |
default is |
Value
A tibble with percentage
for the LC or LT value desired for the above percentage argument, dose_1
and dose_2
displayed calculated backtransformed or untransformed doses for the desired LC or LT values. Standard Error (se
), Z test statistic (test_stat
) and p_value
determined using Z test statistic as determined using formulas in Wheeler et al. 2006.
.
References
Wheeler, M.W., Park, R.M., and Bailey, A.J., 2006. Comparing median lethal concentration values using confidence interval overlap or ratio tests, Environ. Toxic. Chem. 25(5), 1441-1444.10.1897/05-320R.1
Examples
# view lamprey_tox data
head(lamprey_tox)
# using glm() to detemine LC values using probit model for May and June
m <- glm((response / total) ~ log10(dose),
data = lamprey_tox[lamprey_tox$nominal_dose != 0, ],
subset = c(month == "May"),
weights = total,
family = binomial(link = "probit"))
j <- glm((response / total) ~ log10(dose),
data = lamprey_tox[lamprey_tox$nominal_dose != 0, ],
subset = c(month == "June"),
weights = total,
family = binomial(link = "probit"))
# now that both May and June models have been made. use ratio_test to
# compare LC50 values or whatever LC values of interest.
ratios <- ratio_test(model_1 = m, model_2 = j, percentage = 50,
compare = "May - June")
# view ratio test results
ratios
# you can also use LC_probit to create the models and use ratio test
m_1 <- LC_probit((response / total) ~ log10(dose), p = c(50, 99),
weights = total,
data = lamprey_tox[lamprey_tox$nominal_dose != 0, ],
subset = c(month == "May"))
j_1 <- LC_probit((response / total) ~ log10(dose), p = c(50, 99),
weights = total,
data = lamprey_tox[lamprey_tox$nominal_dose != 0, ],
subset = c(month == "June"))
ratios_2 <- ratio_test(model_1 = m_1, model_2 = j_1, percentage = 50,
compare = "May - June", obj_type = "df")
ratios_2