Skip to content

Commit

Permalink
Small corrections if start_levels are specified
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshay218 committed May 17, 2024
1 parent 7aa296a commit e8c7313
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 13 additions & 3 deletions R/plot_antibody_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,15 @@ plot_model_fits <- function(chain, infection_histories,
possible_exposure_times <- possible_exposure_times_tmp
}
}

if(class(start_level) == "character"){
start_levels <- create_start_level_data(antibody_data %>%
dplyr::filter(individual %in% individuals),start_level,FALSE) %>%
dplyr::arrange(individual, biomarker_group, sample_time, biomarker_id, repeat_number)
} else if(class(start_level) %in% c("tibble","data.frame")){
start_levels <- start_levels
} else {
start_levels <- NULL
}
## Generate antibody predictions
antibody_preds <- get_antibody_level_predictions(
chain, infection_histories, antibody_data,
Expand Down Expand Up @@ -417,9 +422,14 @@ plot_antibody_predictions <- function(chain, infection_histories,
possible_exposure_times <- possible_exposure_times_tmp
}
}

start_levels <- create_start_level_data(antibody_data,start_level,FALSE) %>%
if(class(start_level) == "character"){
start_levels <- create_start_level_data(antibody_data,start_level,FALSE) %>%
dplyr::arrange(individual, biomarker_group, sample_time, biomarker_id, repeat_number)
} else if(class(start_level) %in% c("tibble","data.frame")){
start_levels <- start_levels
} else {
start_levels <- NULL
}
## Generate antibody predictions
x <- get_antibody_level_predictions(
chain, infection_histories, antibody_data, individuals=unique(antibody_data$individual),
Expand Down
3 changes: 1 addition & 2 deletions R/posteriors.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ create_posterior_func <- function(par_tab,
if(verbose) message(cat("Note: no biomarker_group detected in measurement_bias Assuming all biomarker_group as 1.\n"))
measurement_bias$biomarker_group <- 1
}

if(verbose){
if(verbose & any(class(start_level) == "character")){
message(cat("Setting starting antibody levels based on data using command:", start_level, "; and randomizing starting antibody levels set to:", start_level_randomize, "\n"))
}

Expand Down

0 comments on commit e8c7313

Please sign in to comment.