Skip to content

Commit 9c640bd

Browse files
Copilotd-morrison
andcommitted
Add roxygen2 documentation to update_possible_subj_data function
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
1 parent 958f621 commit 9c640bd

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

R/update_possible_subj_data.R

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
#' Update subject-level data with posterior probabilities
2+
#'
3+
#' Internal helper function that updates subject-level data by computing
4+
#' various conditional probabilities used in the EM algorithm for
5+
#' fitting the joint model. This function combines observation-level
6+
#' predictions with participant-level data and omega estimates to compute
7+
#' posterior probabilities needed for parameter estimation.
8+
#'
9+
#' @param obs_data_possibilities A [data.frame] containing all possible
10+
#' observation-level data combinations, including ID, S (possible
11+
#' seroconversion dates), and Y (MAA classifications).
12+
#' @param MAA_model A fitted [stats::glm()] model object used to predict
13+
#' P(Y=1|T=t), the probability of MAA-positive status given time since
14+
#' seroconversion.
15+
#' @param participant_level_data A [data.frame] containing participant-level
16+
#' information, including ID, Stratum, and P(S>=l|E=e) (the probability
17+
#' that seroconversion occurs on or after the last negative test date).
18+
#' @param omega_hat A [data.frame] containing estimated parameters for the
19+
#' seroconversion date distribution model, including S, Stratum, P(S=s|S>=s,E=e),
20+
#' and P(S>s|S>=s,E=e).
21+
#'
22+
#' @returns A [data.frame] containing updated subject-level data with the
23+
#' following columns:
24+
#' \itemize{
25+
#' \item `ID`: Participant identifier
26+
#' \item `Stratum`: Stratification variable
27+
#' \item `S`: Possible seroconversion date
28+
#' \item `P(Y=y|T=t)`: Probability of observed MAA outcomes given time since
29+
#' seroconversion
30+
#' \item `P(S=s|E=e)`: Marginal probability of seroconversion at time s given
31+
#' enrollment date
32+
#' \item `P(S=s|e,l,r,o,y)`: Posterior probability of seroconversion at time s
33+
#' given all observed data (used to estimate omega and theta)
34+
#' \item `P(S>=s|e,l,r,o,y)`: Posterior probability that seroconversion occurs
35+
#' on or after time s (used to estimate omega)
36+
#' }
37+
#'
38+
#' @keywords internal
139
update_possible_subj_data <- function(
240
obs_data_possibilities,
341
MAA_model,

0 commit comments

Comments
 (0)