Skip to content

Commit

Permalink
Merge pull request #53 from Merck/cranprep
Browse files Browse the repository at this point in the history
Edits to enable win-builder pass
  • Loading branch information
dom-muston committed Jun 7, 2024
2 parents 5878b22 + 5d5ea66 commit b09105e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
9 changes: 4 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# psm3mkv 0.3.2

# psm3mkv 0.3.2
# psm3mkv 0.3.2 (7 June 2024)

- Revised calculations of constrained restricted mean durations in internal function `calc_drmd()` and the accompanying `vignette("background-mortality")`.
- Add new data option: `create_dummydata("pharmaonc")` provides a dataset based on `pharmaverseadam::adsl()` and `pharmaverseadam::adrs_onco()`. This requires a dependency to `admiral` and `pharmaverseadam` packages.
- Provide a convenience function, `compare_psm_likes()`, to compare the total log-likelihood values for the patient-level dataset after fitting PSM-simple and PSM-complex models to each combination of endpoint distributions.
- Add citation to publication in *Applied Health Economics and Health Policy*, [DOI: 10.1007/s40258-024-00884-2 ](https://doi.org/10.1007/s40258-024-00884-2).
- Updated license statements to 2024

# psm3mkv 0.3.1
# psm3mkv 0.3.1 (7 May 2024)

- Submission to CRAN, including changes requested by CRAN

# psm3mkv 0.3.0
# psm3mkv 0.3.0 (5 May 2024)

- First submission to CRAN, not accepted

Expand Down
6 changes: 3 additions & 3 deletions R/likepsm.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
#' @param fitslist List of distribution fits to relevant endpoints, after calling `fit_ends_mods_par()` or `fit_ends_mods_spl()`
#' @importFrom rlang .data
#' @return List containing
#' - `res`: Dataset of calculation results for each model
#' - `best`: Tibble indicating which is the best fitting model individually or jointly, to each endpoint, according to AIC or BIC
#' - `results`: Dataset of calculation results for each model
#' - `bests`: Tibble indicating which is the best fitting model individually or jointly, to each endpoint, according to AIC or BIC
#' @export
#' @examples
#' # Fit parametric distributions to a dataset
#' bosonc <- create_dummydata("flexbosms")
#' parfits <- fit_ends_mods_par(bosonc)
#' \donttest{
#' splfits <- fit_ends_mods_spl(bosonc)
#' # Present comparison of likelihood calculations
#' \donttest{
#' compare_psm_likes(bosonc, parfits)
#' compare_psm_likes(bosonc, splfits)
#' }
Expand Down
6 changes: 3 additions & 3 deletions man/compare_psm_likes.Rd

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

2 changes: 1 addition & 1 deletion vignettes/example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Once we have a suitable dataset, we will fit statistical models to these six end

### Parametric distributions

Let us start by considering parametric distributions. This uses the function `fit_ends_mods_par()`, so called because it cycles through fitting endpoints and models. The original dataset contained only three of these endpoints, the other three endpoints are calculated within the function.
Let us start by considering parametric distributions. This uses the function `fit_ends_mods()`, so called because it cycles through fitting endpoints and models. The original dataset contained only three of these endpoints, the other three endpoints are calculated within the function.

```{r fit_ends_mods_par}
# Create a vector of distributions of interest (flexsurv notation)
Expand Down
11 changes: 5 additions & 6 deletions vignettes/mortality-adjustments.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ res3 |> mutate(
proppf3 <- res3$pf / res3$os
```

There is now a large difference between the STM-CR compared to the STM-CF and PSM structures. All structures estimate fairly similar RMD estimates of being alive (range: `r round(min(res3$os),1)` to `r round(max(res3$os),1)` weeks). The estimate of mean time alive in the STM-CR structure has reduced by `r round(res1$os[3]-res3$os[3],1)` weeks from `r round(res1$os[3],1)` to `r round(res3$os[3],1)` weeks.
There is now some difference between the STM-CR compared to the STM-CF and PSM structures. All structures estimate fairly similar RMD estimates of being alive (range: `r round(min(res3$os),1)` to `r round(max(res3$os),1)` weeks). The estimate of mean time alive in the STM-CR structure has reduced by `r round(res1$os[3]-res3$os[3],1)` weeks from `r round(res1$os[3],1)` to `r round(res3$os[3],1)` weeks.

The proportion of that time in the PF rather than PD state varies considerably (PSM: `r round(100*proppf3[1], 1)`%, STM-CF: `r round(100*proppf3[2], 1)`%, STM-CR: `r round(100*proppf3[3], 1)`%). Given that the hazard of mortality would typically be lower before rather than after progression, the pre-progression mortality is likely to be more affected by any mortality constraint that post-progression mortality. The STM-CR model of post-progression survival depends on time from progression and is therefore rather different from the STM-CF and PSM structures, which model mortality based on time from baseline.
The proportion of that time in the PF rather than PD state varies somewhat (PSM: `r round(100*proppf3[1], 1)`%, STM-CF: `r round(100*proppf3[2], 1)`%, STM-CR: `r round(100*proppf3[3], 1)`%). Given that the hazard of mortality would typically be lower before rather than after progression, the pre-progression mortality is likely to be more affected by any mortality constraint that post-progression mortality. The STM-CR model of post-progression survival depends on time from progression and is therefore rather different from the STM-CF and PSM structures, which model mortality based on time from baseline.

We can check whether using a 'complex' type of PSM structure rather than the default 'simple' affects RMD estimates from the PSM structure.

Expand All @@ -281,7 +281,7 @@ res4 |> mutate(
proppf4 <- res4$pf / res4$os
```

All structures estimate fairly similar RMD estimates of being alive (range: `r round(min(res4$os),1)` to `r round(max(res4$os),1)` weeks). The proportion of that time in the PF rather than PD state varied again considerably by model structure (PSM: `r round(100*proppf4[1], 1)`%, STM-CF: `r round(100*proppf4[2], 1)`%, STM-CR: `r round(100*proppf4[3], 1)`%).
All structures estimate fairly similar RMD estimates of being alive (range: `r round(min(res4$os),1)` to `r round(max(res4$os),1)` weeks). The proportion of that time in the PF rather than PD state varied a little by model structure (PSM: `r round(100*proppf4[1], 1)`%, STM-CF: `r round(100*proppf4[2], 1)`%, STM-CR: `r round(100*proppf4[3], 1)`%).

### Comparing the results

Expand Down Expand Up @@ -316,9 +316,8 @@ A summary of the PSM estimates of mean time in PF state and mean time alive is g

The change in the RMDs for the 'complex' PSM structure compared to the 'simple' PSM structure were `r round(res4$pf[1]-res3$pf[1], 1)`, `r round(res4$pd[1]-res3$pd[1], 1)` and `r round(res4$os[1]-res3$os[1], 1)` weeks respectively for time in PF state, PD state and time alive.

### For further investigation
### Possible extensions

- The effect of the lifetable constraint on the STMs was much greater - especially to time in the PF state - in the STMs rather than the PSM.
- The package also allows application of discounting through the `discrate` optional call to `calc_allrnds()`.
Not applied here, the package also allows application of discounting through the `discrate` optional call to `calc_allrnds()`. This work could also be easily extended through calculating RMDs or Life Years that are Quality Adjusted (QALYs).

## References

0 comments on commit b09105e

Please sign in to comment.