negLL_Weibull_counts_tibble: Calculate negative log-likelihood for the Weibull...

Description Usage Arguments Value Author(s)

View source: R/likelihood.R

Description

Calculate the negative log-likelihood of the parameters k and lambda given count data. Returns the negative log-likelihood. Will be called by nlm() or similar. Data are in a data frame tibble format rather than matrix format (as in negLL_Weibull_counts_matrix()) since the matrix will always be upper triangular (so using a long data frame should be faster), and data frame is easier to obtain from real data. This is also set up to do confidence intervals (unlike negLL_Weibull_counts_matrix()).

Usage

1
2
3
4
5
6
negLL_Weibull_counts_tibble(
  p = c(3, 15),
  h_nr_tibble,
  k_MLE = NULL,
  lambda_MLE = NULL
)

Arguments

p

vector of parameter values c(k, lambda) (shape and scale, respectively) for which to calculate the negative log-likelihood, or just one or the other if k_MLE or lambda_MLE are specified (for univariate confidence intervals).

h_nr_tibble

tibble of counts of numbers of individuals whose case was reported on day r and who first reported symptoms on day n. r and n start from 0. Dataframe has columns n, r and h_nr (with all $h_nr > 0$), which is more concise than the matrix formulation with lots of 0's. So $h_ab$ in the math is dplyr::filter(h_nr_df, n = a, r = b)$h_nr (the pairwise combinations of n and r are unique).

k_MLE

fixed value of k_MLE to use for calculating univariate confidence interval of lambda (needed since profLike() is univariate)

lambda_MLE

fixed value of lambda_MLE to use for calculating univariate confidence interval of k.

Value

negative log-likelihood of the parameters given the data

Author(s)

Andrew Edwards


andrew-edwards/rightTruncation documentation built on Jan. 18, 2021, 7:43 p.m.