VPC raw data for plotting

Hello,

I am aware that vpc function can output only the predicted percentiles. Is there a way to get the raw data for the vpc plot ( including the observed data, observed percentiles and the prediction interval)?

Thanks

hi @ahmed.salem -
A vpc call would only give you the simulated quantiles and observed quantiles but does not store the raw data (correct, @pkofod ?)

However, from Pumas 2.3 onwards you should be able to simulate with simobs and pass the simulated object into vpc to quantify your quantiles and subsequently plot them. The dummy code would look something like this.

Step 1: Simulate nreps

# 10 replications
sim_10rep = [
    simobs(
        orig_model,
        original_pop,
        fitted_params,
        obstimes = 0:1:196,
        simulate_error = false, # if you don't want to include residual variability in your simulations
    ) for i = 1:10
]

Step 2: Concatenate the resulting dataframe (Not a required step, only if you want view the results as a dataframe)

sim_10rep_df = reduce(vcat, DataFrame.(sim_10rep), source = "rep")

Step 3: Pass the simulation object into the vpc (Note that here we are using the result from Step 1)

vpc10rep = vpc(sim_10rep)

Step 4: Plot you vpc

vpc_plot(vpc10rep)

Does that help?

1 Like

OK, that makes sense. Thanks for the reply.

vpc should be called on sim_10rep directly not the dataframe.

1 Like

Thanks, I updated the post above to reflect the change

1 Like