Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
queelius committed Feb 7, 2024
1 parent 8117edd commit 705b9ac
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 25 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ Suggests:
knitr,
tibble,
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@ S3method(loglik,likelihood_contr_model)
S3method(loglik,likelihood_exact_normal)
S3method(loglik,likelihood_exact_weibull)
S3method(loglik,likelihood_name)
S3method(pval,hypothesis_test)
S3method(sampler,likelihood_model)
S3method(score,likelihood_contr_model)
S3method(score,likelihood_exact_normal)
S3method(score,likelihood_exact_weibull)
S3method(score,likelihood_model)
export(assumptions)
export(dof)
export(fim)
export(hess_loglik)
export(hypothesis_test)
export(is_likelihood_model)
export(likelihood_contr_model)
export(likelihood_exact_normal)
export(likelihood_exact_weibull)
export(likelihood_name)
export(loglik)
export(lrt)
export(pval)
export(score)
importFrom(MASS,ginv)
importFrom(R6,R6Class)
Expand All @@ -46,5 +50,9 @@ importFrom(numDeriv,grad)
importFrom(numDeriv,hessian)
importFrom(stats,nobs)
importFrom(stats,optim)
importFrom(stats,pchisq)
importFrom(stats,pf)
importFrom(stats,qnorm)
importFrom(stats,qt)
importFrom(stats,var)
importFrom(utils,modifyList)
7 changes: 3 additions & 4 deletions R/likelihood_contr_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
#' - `score`: computes the score of the model
#' - `hess_loglik`: computes the Hessian of the log-likelihood given
#' a data frame and parameters
#' - `fim`: computes the Fisher information matrix (expectation)
#'
#' It provides methods for computing the log-likelihood, score, the
#' Hessian of log-likelihood, and the Fisher information matrix (FIM).
#' It provides methods for computing the log-likelihood, score, and
#' the Hessian of log-likelihood.
#'
#' It also allows for different *likelihood contributions* depending
#' It also allows for different likelihood contributions depending
#' on the observation type of a row in the data frame. For example,
#' if the data frame contains both exact and interval-censored
#' observations, then the log-likelihood contributions for exact
Expand Down
10 changes: 4 additions & 6 deletions R/likelihood_name.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,17 @@ assumptions.likelihood_name <- function(model, ...) {
#' parameters.
#' @export
loglik.likelihood_name <- function(model, ...) {
x <- as.data.frame(df)[[model$ob_col]]
n <- length(x)
stopifnot(n > 0)

if (is.null(model$type_col)) {
function(df, par, ...) {
x <- as.data.frame(df)[[model$ob_col]]
n <- length(x)
stopifnot(n > 0, all(x > 0))
do.call(paste0("d", model$dist_name), c(list(x), par))
sum(do.call(paste0("d", model$dist_name), c(list(x), par), log.p = TRUE))
}
} else {
function(df, par, ...) {
x <- as.data.frame(df)[[model$ob_col]]
n <- length(x)
stopifnot(n > 0)
type <- as.character(df[[model$type_col]])
ifelse(type == "left",
do.call(paste0("p", model$dist_name), c(list(x), par)),
Expand Down
19 changes: 19 additions & 0 deletions man/dof.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions man/hess_loglik.likelihood_exact_normal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions man/hypothesis_test.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions man/likelihood_contr_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions man/lrt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/pval.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/pval.hypothesis_test.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 705b9ac

Please sign in to comment.