Skip to content

Align data processing of predict() and modeling functions - #6

Merged
wlandau merged 2 commits into
mainfrom
5
Feb 19, 2026
Merged

wlandau merged 2 commits into
mainfrom
5

Conversation

@wlandau

@wlandau wlandau commented Feb 19, 2026

Copy link
Copy Markdown
Member

In this PR,pmrm uses all of pmrm_data() and rebuilds all ordered factors in predict(). Previously, predict() did only part of the processing from pmrm_data(). The following reprex now succeeds:

library(pmrm)
library(tidyverse)
set.seed(0L)
simulation <- pmrm_simulate_decline_proportional(
  visit_times = seq_len(5L) - 1
)
fit <- pmrm_model_decline_proportional(
  data = simulation,
  outcome = "y",
  time = "t",
  patient = "patient",
  visit = "visit",
  arm = "arm"
)
new_data <- tibble(
  patient = "pt_new_1",
  visit = factor(paste0("visit_", 1:5), ordered = T),
  t = 0:4,
  arm = "arm_1"
)
predict(fit, new_data)
#> # A tibble: 5 × 8
#>   patient  arm   visit    time  estimate standard_error  lower upper
#>   <fct>    <chr> <ord>   <int>     <dbl>          <dbl>  <dbl> <dbl>
#> 1 pt_new_1 arm_1 visit_1     0 -0.000613         0.0579 -0.114 0.113
#> 2 pt_new_1 arm_1 visit_2     1  0.702            0.0684  0.568 0.836
#> 3 pt_new_1 arm_1 visit_3     2  1.04             0.0732  0.895 1.18 
#> 4 pt_new_1 arm_1 visit_4     3  1.38             0.0770  1.23  1.53 
#> 5 pt_new_1 arm_1 visit_5     4  1.64             0.0834  1.48  1.81

Created on 2026-02-19 with reprex v2.1.1

FYI @lbenz-lilly

@codecov

codecov Bot commented Feb 19, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@wlandau
wlandau merged commit a11fb61 into main Feb 19, 2026
17 checks passed
@wlandau
wlandau deleted the 5 branch February 19, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant