EVID error when converting dataframe with read_pumas

I read a csv as a dataframe with CSV.read which looks like:

 Row │ id     time     observations   amt        dosegrp  evid  
     │ Int64  Float64  Float64?       Float64?   Float64  Int64 
   1 │     1  -0.5           1.0      missing        0.0      0
   2 │     1   0.0     missing              0.0      0.0      1
   3 │     1   0.1667        1.17532  missing        0.0      0
   4 │     1   0.5           1.06483  missing        0.0      0

and when using read_pumas I get the following error:

PumasDataError: Some dose-related data items must be non-zero when evid is 1

which is quite cryptic and doesn’t help. Maybe one of you can help?

It works if I drop the :evid column, although I then get a warning.
If I convert the population back to dataframe with DataFrame(data_pop) I get the following

4×4 DataFrame
 Row │ id      time     evid   observations  
     │ String  Float64  Int64  Float64?      
   1 │ 1       -0.5         0        1.0
   2 │ 1        0.0         0  missing       
   3 │ 1        0.1667      0        1.17532
   4 │ 1        0.5         0        1.06483

There is now an :evid column but it is 0 and not 1 when the dose is administered at time=0.0. I’m confused.

Hm, ok, I subsetted the dataframe with dosegrp > 0 and then it works. How would I set up a PD dataset with placebo data, i.e. dose = 0 to fit something like a turnover model?

If you want to run a model without any dose, you can add event_data = false like below.

pkdata = read_pumas(data,
                    observations  = [:dv],
                    id            = :id,
                    time          = :time,
                    event_data    = false)

Thank you for getting back to me. I don’t want to add a model without a dose. It’s just that some subjects get a placebo while others get an active dose and for all of them some PD marker is measured. And I want to model all of them to not only get the baseline of the marker but also the effect after increasing doses.

If you set EVID = 1, the amount should be positive. I am not sure if there is a way to include placebo subjects to PK model.

Why do you need the rows with amt=0? They wouldn’t affect the system, right?

This is PD data and should inform a turnover model, for instance. And there the placebo subjects do contribute to informing kin and kout as well as the random effects of these parameters.

I think what @andreasnoack is saying is that you should filter out the dose rows for the placebo subjects (i.e., rows with evid=1 and amt=0). You can leave the observation rows (evid=0) for those subjects so that they contribute information, and of course for treated subjects you would include both doses and observations. Does this make sense?

It does. Thanks, I’ll try that.