Skip to content

Commit

Permalink
Merge pull request #30 from Suhyeon-Kwon/master
Browse files Browse the repository at this point in the history
Add AIC metric to `cox2.display`.
  • Loading branch information
jinseob2kim authored May 31, 2024
2 parents 4a04421 + cd01ea8 commit e889bd3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: jstable
Title: Create Tables from Different Types of Regression
Version: 1.2.5
Date: 2024-05-08
Version: 1.2.6
Date: 2024-05-31
Authors@R: c(person("Jinseob", "Kim", email = "jinseob2kim@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")),
person("Zarathu", role = c("cph", "fnd")),
person("Yoonkyoung","Jeon", role = c("aut"))
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# jstable 1.2.6

* Add AIC metric to `cox2.display`.

# jstable 1.2.5

* Update: Add `cluster` option to `TableSubgroupCox` and `TableSubgroupMultiCox` for marginal cox model. ex: `cluster = "inst"`
Expand Down
7 changes: 4 additions & 3 deletions R/cox2.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @rdname cox2.display
#' @export
#' @importFrom survival coxph cluster frailty
#' @importFrom stats formula update
#' @importFrom stats formula update AIC

cox2.display <- function(cox.obj.withmodel, dec = 2) {
model <- cox.obj.withmodel
Expand Down Expand Up @@ -191,8 +191,9 @@ cox2.display <- function(cox.obj.withmodel, dec = 2) {
# no.grp = unlist(lapply(model$frail, length))
no.obs <- model$n
no.event <- model$nevent
metric.mat <- cbind(c(NA, no.obs, no.event), matrix(NA, 3, ncol(fix.all) - 1))
rownames(metric.mat) <- c(NA, "No. of observations", "No. of events")
aic <- stats::AIC(model)
metric.mat <- cbind(c(NA, no.obs, no.event, aic), matrix(NA, 4, ncol(fix.all) - 1))
rownames(metric.mat) <- c(NA, "No. of observations", "No. of events", "AIC")

## Integrated ll
# ll = model$loglik[2]
Expand Down

0 comments on commit e889bd3

Please sign in to comment.