Reading Covariates with missing data

I am trying to include a covariate (Bili) into the data set. This covariate has missing rows and I get the error message : BoundsError: attempt to access 0-element Array{Float64,1} at index [0]
Any suggestions?
Here is the code:

par_glu_cov = read_pumas(df_belino,
                    cvs     =   [:Gender,:BSA, :Cohort, :Weight, :Bili],
                    dvs     =   [:Conc_B, :Conc_Glucu],
                    id      =   :Patient,
                    time    =   :Time,
                    evid    =   :evid,
                    amt     =   :Amt,
                    rate    =   :rate
                    )
 BoundsError: attempt to access 0-element Array{Float64,1} at index [0]
1 Like

The problem is that for one of the subjects, there are no non-missing values of the covariate. Specifically,

julia> filter(i -> i.Patient == [xxx], df_belino)[!,[:Bili]]
14Γ—1 DataFrame
β”‚ Row β”‚ Bili     β”‚
β”‚     β”‚ Float64⍰ β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1   β”‚ missing  β”‚
β”‚ 2   β”‚ missing  β”‚
β”‚ 3   β”‚ missing  β”‚
β”‚ 4   β”‚ missing  β”‚
β”‚ 5   β”‚ missing  β”‚
β”‚ 6   β”‚ missing  β”‚
β”‚ 7   β”‚ missing  β”‚
β”‚ 8   β”‚ missing  β”‚
β”‚ 9   β”‚ missing  β”‚
β”‚ 10  β”‚ missing  β”‚
β”‚ 11  β”‚ missing  β”‚
β”‚ 12  β”‚ missing  β”‚
β”‚ 13  β”‚ missing  β”‚
β”‚ 14  β”‚ missing  β”‚

and in that case, it’s not possible to use that covariate. The solution is probably to manually set the first entry to a reasonable value. However, we should provide a more informative error message. I’ll file an issue.

2 Likes

Thanks Andreas. I get the problem now.