Nothing
## ----include=FALSE------------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 7,
fig.height = 4.5, dpi = 96)
## ----setup--------------------------------------------------------------------
library(freqTLS)
data(dsuzukii)
## ----data---------------------------------------------------------------------
cell <- interaction(dsuzukii$temp, dsuzukii$lvl, dsuzukii$sex, drop = TRUE)
coma <- do.call(rbind, lapply(split(dsuzukii, cell), function(d) {
data.frame(
temp = d$temp[1], lvl = d$lvl[1], sex = d$sex[1],
duration = d$time[1], n_total = nrow(d),
n_awake = sum(is.na(d$t_coma))
)
}))
coma <- droplevels(subset(coma, duration > 0))
coma_std <- standardize_data(
coma, temp = "temp", duration = "duration",
n_total = "n_total", n_surv = "n_awake", duration_unit = "minutes"
)
## ----fit----------------------------------------------------------------------
coma_fit <- fit_4pl(
coma_std,
ctmax = ~ sex,
z = ~ sex,
low = ~ temp_c,
up = ~ temp_c,
k = ~ temp_c,
family = "beta_binomial",
t_ref = 60,
method = "wald",
quiet = TRUE
)
diagnose_tdt_fit(coma_fit)
check_tls(coma_fit)
## ----shape-identification-----------------------------------------------------
coma_shape <- subset(
coma_fit$fit$estimates,
grepl("^(low|up|k):", parameter),
select = c(parameter, estimate, std.error)
)
coma_shape
## ----quantities---------------------------------------------------------------
coma_table <- tls(coma_fit, by = "sex", lethal = FALSE, method = "wald")$summary
names(coma_table)[names(coma_table) == "median"] <- "estimate"
coma_table
## ----fitted-curves, fig.alt="Observed awake proportions and fitted Drosophila suzukii awake-coma curves, separated by sex and assay temperature."----
plot_survival_curves(coma_fit)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.