Skip to content

Simulate a parameter that is not normally distributed (but rather a mixture from populations) #645

Answered by mattfidler
mattfidler asked this question in Q&A
Discussion options

You must be logged in to vote

You can simulate non-normal distributions outside the rxode2 solve and then supply them to the solving rxSolve

See

library(rxode2)
#> Warning: package 'rxode2' was built under R version 4.3.2
#> rxode2 2.1.1 using 4 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`

set.seed(10)

kaPop <- c(rnorm(n=0.2*1e6, mean = 1, sd = 0.1),
            rnorm(n=0.4*1e6, mean = 1.5, sd = 0.2),
            rnorm(n=0.4*1e6, mean = 2, sd = 0.3))

pars <- do.call(rbind,
        lapply(seq_along(1:100), function(i) {
          u <- runif(1, 0, 1)
          data.frame(ka=quantile(kaPop, probs=u), V=10,
                     prop.sd=0.1, add.sd=0.1)  
        }))

mod <- function(){
  mod…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mattfidler
Comment options

mattfidler Jan 17, 2024
Maintainer Author

Answer selected by mattfidler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant