hi Robert,
We don’t require that data is in long form and in fact suggest that the data should be in wide form for Pumas modeling. So, if you have a NM dataset with multiple DV’s stacked on top of each other, you could unstack them and work so that you derived block can specify a distribution for each variable. A reproducible example for you to adapt the code from is below.
Hope that helps
julia> df = DataFrame(id = [1,1,1,2,2,2],
amt = [1, 0, 0, 1, 0,0],
time = [0,1,1,0,1,1],
dv = [0,1.2,8.2,0,1.1,9.1],
cmt = [:Depot,:Parent,:Metab,:Depot,:Parent,:Metab])
6×5 DataFrame
│ Row │ id │ amt │ time │ dv │ cmt │
│ │ Int64 │ Int64 │ Int64 │ Float64 │ Symbol │
├─────┼───────┼───────┼───────┼─────────┼────────┤
│ 1 │ 1 │ 1 │ 0 │ 0.0 │ Depot │
│ 2 │ 1 │ 0 │ 1 │ 1.2 │ Parent │
│ 3 │ 1 │ 0 │ 1 │ 8.2 │ Metab │
│ 4 │ 2 │ 1 │ 0 │ 0.0 │ Depot │
│ 5 │ 2 │ 0 │ 1 │ 1.1 │ Parent │
│ 6 │ 2 │ 0 │ 1 │ 9.1 │ Metab │
julia> df_wide = unstack(df, [:id, :time, :amt], :cmt, :dv)
4×6 DataFrame
│ Row │ id │ time │ amt │ Depot │ Metab │ Parent │
│ │ Int64 │ Int64 │ Int64 │ Float64? │ Float64? │ Float64? │
├─────┼───────┼───────┼───────┼──────────┼──────────┼──────────┤
│ 1 │ 1 │ 0 │ 1 │ 0.0 │ missing │ missing │
│ 2 │ 1 │ 1 │ 0 │ missing │ 8.2 │ 1.2 │
│ 3 │ 2 │ 0 │ 1 │ 0.0 │ missing │ missing │
│ 4 │ 2 │ 1 │ 0 │ missing │ 9.1 │ 1.1 │
julia> df_wide[!, :cmt] = ifelse.(df_wide.time .== 0, 1, missing)
4-element Array{Union{Missing, Int64},1}:
1
missing
1
missing
julia> df_wide[!, :evid] = ifelse.(df_wide.time .== 0, 1, 0)
4-element Array{Int64,1}:
1
0
1
0
julia> select!(df_wide, Not(:Depot))
4×7 DataFrame
│ Row │ id │ time │ amt │ Metab │ Parent │ cmt │ evid │
│ │ Int64 │ Int64 │ Int64 │ Float64? │ Float64? │ Int64? │ Int64 │
├─────┼───────┼───────┼───────┼──────────┼──────────┼─────────┼───────┤
│ 1 │ 1 │ 0 │ 1 │ missing │ missing │ 1 │ 1 │
│ 2 │ 1 │ 1 │ 0 │ 8.2 │ 1.2 │ missing │ 0 │
│ 3 │ 2 │ 0 │ 1 │ missing │ missing │ 1 │ 1 │
│ 4 │ 2 │ 1 │ 0 │ 9.1 │ 1.1 │ missing │ 0 │
julia> df_wide
4×7 DataFrame
│ Row │ id │ time │ amt │ Metab │ Parent │ cmt │ evid │
│ │ Int64 │ Int64 │ Int64 │ Float64? │ Float64? │ Int64? │ Int64 │
├─────┼───────┼───────┼───────┼──────────┼──────────┼─────────┼───────┤
│ 1 │ 1 │ 0 │ 1 │ missing │ missing │ 1 │ 1 │
│ 2 │ 1 │ 1 │ 0 │ 8.2 │ 1.2 │ missing │ 0 │
│ 3 │ 2 │ 0 │ 1 │ missing │ missing │ 1 │ 1 │
│ 4 │ 2 │ 1 │ 0 │ 9.1 │ 1.1 │ missing │ 0 │