View source: R/fitdistdoublecens.R
fitdistdoublecens | R Documentation |
This function wraps the custom approach for fitting distributions to doubly censored data using fitdistrplus and primarycensored.
fitdistdoublecens(
censdata,
distr,
pwindow = 1,
D = Inf,
dprimary = stats::dunif,
dprimary_name = lifecycle::deprecated(),
dprimary_args = list(),
truncation_check_multiplier = 2,
...
)
This function temporarily assigns and then removes functions from the global environment in order to work with fitdistr. Users should be aware of this behaviour, especially if they have existing functions with the same names in their global environment.
An object of class "fitdist" as returned by fitdistrplus::fitdist.
Modelling wrappers for external fitting packages
pcd_as_stan_data()
,
pcd_cmdstan_model()
# Example with normal distribution
set.seed(123)
n <- 1000
true_mean <- 5
true_sd <- 2
pwindow <- 2
swindow <- 2
D <- 10
samples <- rprimarycensored(
n, rnorm,
mean = true_mean, sd = true_sd,
pwindow = pwindow, swindow = swindow, D = D
)
delay_data <- data.frame(
left = samples,
right = samples + swindow
)
fit_norm <- fitdistdoublecens(
delay_data,
distr = "norm",
start = list(mean = 0, sd = 1),
D = D, pwindow = pwindow
)
summary(fit_norm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.