Corrected observation from pcVPC

Hello,
I was wondering if it’s possible to export corrected observations obtained from pcVPC. I found codes for simulated and observed percentiles but not observations. Is there any function for it?
Thank you!

Dear Dawoon,

I can help you figure this out. Can I ask you what the intended use case is? To make your own plot from the data in the vpc-output?

Best,
Patrick

Hello, Patrick

Yes, I am making my own plot with the observations overlaid in the pcVPC.

Sorry for not getting back to you. It was late when I saw your message, and it had escaped my head again the next morning.

We don’t have an official interface for this, but I can tell you where to find it. Since it’s not an official interface, I cannot promise that we do not change this is in the future, but since you asked we may consider to supply some functions to grab this information that will be an official interface at that point.

If you vpc is called myvpc you can get the internal field popvpc that has a field called data. This is a Population with prediction corrected observations. You can construct a DataFrame from that object.

DataFrame(myvpc.popvpc.data)

You can try to compare with a VPC object that is not prediction corrected, and see that the observations do indeed differ.

As I said, this is not a feature we officially support, so it may break in future version of Pumas, but I have opened an issue to track this in our development team.

Hello, Patrick

Thank you so much for your response. When I pass the code, it gives the output as shown in the snippet. Could you please advise me how to convert the population to the dataframe with id, time, observations, etc? Thank you!
image

@donaldlee3 advised me to try DataFrame.() instead of DataFrame() and it worked!

1 Like

That gave you a vector of DataFrames right? Your population must have had some kind of heterogeneity. Could you tell me if DataFrame(identity.(vpc_fpm.popvpc.data)) works as well?

Yes, it was a vector of DF.
DataFrame.(identity.(vpc_fpm.popvpc.data)) works too!

Wait, now I see it. Try this

DataFrame.(identity.(vpc_fpm.popvpc.data[1]))

To explain what is going on, vpc_fpm.popvpc is a type that holds information about the constructed vpc curves. vpc_fpm.popvpc.data is the data used to construct the vpc curves, but for the actual data (not simulations) there is only one realization. So you need to take the first element of data - a Population. This can then be data framed. We’ll see if we can’t get a getter function for this data into the next release although we are very close to feature freeze on v2.6.

It gives me an individual DF for each id.

Thank you so much for supporting!

1 Like