Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bmstate
Type: Package
Title: Bayesian multistate modeling
Version: 0.3.1
Version: 0.3.3
Authors@R:
c(person(given = "Juho",
family = "Timonen",
Expand Down
2 changes: 1 addition & 1 deletion R/MultistateModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MultistateModel <- R6::R6Class("MultistateModel",
categorical = NULL,
normalizer_locations = NULL,
normalizer_scales = NULL,
xpsr_normalizer_loc = 7.5,
xpsr_normalizer_loc = 5.5, # corresponds to about dose=30
xpsr_normalizer_scale = 0.5,
n_grid = NULL,
simulate_log_hazard_multipliers = function(df_subjects, beta) {
Expand Down
2 changes: 1 addition & 1 deletion R/MultistateModelFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ msmfit_exposure <- function(fit, oos = FALSE, data = NULL) {
out <- list()
for (s in seq_len(S)) {
if (sd$do_pk == 1) {
x_xpsr <- log_ss_area_under_conc(sd$dose_ss, log_pkpar[[s]]) # log D/(CL*V2)
x_xpsr <- log_ss_area_under_conc(sd$dose_ss, log_pkpar[[s]]) # log D/CL
} else {
x_xpsr <- NULL
}
Expand Down
4 changes: 1 addition & 3 deletions R/PKModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ PKModel <- R6::R6Class("PKModel",
#' @return A numeric value
compute_xpsr = function(theta, dose) {
CL <- theta[2]
V2 <- theta[3]
checkmate::assert_number(CL, lower = 0)
checkmate::assert_number(V2, lower = 0)
checkmate::assert_number(dose, lower = 0)
log(dose) - log(CL) - log(V2)
log(dose) - log(CL)
},

#' @description Simulate data with many subjects
Expand Down
3 changes: 1 addition & 2 deletions R/stan.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ fit_stan <- function(model, data,
model$set_normalizers(data)
if (!is.null(data$dosing)) {
log_mu_CL <- -2 # should match msm.stan
log_mu_V2 <- -2 # should match msm.stan
aaa <- log(data$dosing$dose_ss) - log_mu_CL - log_mu_V2
aaa <- log(data$dosing$dose_ss) - log_mu_CL
loc <- mean(aaa)
sca <- stats::sd(aaa)
model$set_xpsr_normalizers(loc, sca)
Expand Down
4 changes: 2 additions & 2 deletions inst/stan/msm.stan
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ functions {

// log SS AUC
vector log_ss_area_under_conc(vector dose_ss, matrix log_theta_pk){
return(log(dose_ss) - log_theta_pk[:,2] - log_theta_pk[:,3]) ; // log D/(CL*V2)
return(log(dose_ss) - log_theta_pk[:,2]) ; // log D/CL
}

// log of hazard multiplier
Expand Down Expand Up @@ -448,7 +448,7 @@ model {
if(do_haz == 1){
if(nc_haz > 0){
for(k in 1:nc_haz){
beta_oth[1, k] ~ normal(0, 2);
beta_oth[1, k] ~ normal(0, 1);
}
}
if(I_xpsr==1){
Expand Down
2 changes: 1 addition & 1 deletion vignettes/analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod$get_knots()
We fit the model by optimizing.

```{r}
fit <- fit_stan(mod, data = pd, method = "optimize")
fit <- fit_stan(mod, data = pd, method = "optimize", init = 0.1)
```

## Inferred baseline hazards
Expand Down