TaskFailedException: Type NamedTuple has not field Out

Hello everyone, I’m new into pumas and have been following all the tutorials I can find. Lately I was trying to fit a very simple model to a dataset I have and I keep getting the same error no matter what:

TaskFailedException: type NamedTuple has not field Out

To give you some context, this is my code:

#Busulfan
using CSV
using Pumas

f=CSV.File("/Users/julianotalvaro/Documents/busulfan.csv",
    missingstrings=["", "NA", "."])

pk_busulfan_df = DataFrame(f)


pk_busulfan = read_pumas(pk_busulfan_df,
                         id=:ID,
                         time=:TIME,
                         amt=:DOSE,
                         observations=[:OUT],
                         covariates=[:AGE, :IBW],
                         evid=:EVID,
                         cmt=:INPUT)

pk_1cmp = @model begin
   @param begin
     tvke ∈ RealDomain(lower = 0, init = 3.2)
     tvv  ∈ RealDomain(lower = 0, init = 16.4)
     Ω    ∈ PDiagDomain(init = [0.04,0.04])
     σ_p  ∈ RealDomain(lower = 0.0001, init = 0.2)
   end
   @random begin
     η ~ MvNormal(Ω)
   end
   @covariates AGE IBW
   @pre begin
     Ke = tvke * exp(η[1])
     Vc = tvv * exp(η[2])
   end
   @dynamics begin
      Central' = -Ke*Central # '
    end
   @derived begin
     cp := @. Central/Vc
     Cl := @. Ke*Vc
     CONC ~ @. Normal(cp, cp*σ_p)
   end
end

pkfit_np = fit(pk_1cmp,
               pk_busulfan,
               init_param(pk_1cmp),Pumas.NaivePooled(),
               omegas = (:Ω,))

pkfit_1cmp = fit(pk_1cmp,
                pk_busulfan,
                init_param(pk_1cmp),
                Pumas.FOCEI(), ensemblealg = EnsembleThreads())

Both fits fail with the same error.

Any clue would be very much appreciated, thank you very much.

Hello Julian,

The name of the observations variables in read_pumas would have to match the names that you use in your @derived block so try changing

CONC ~ @. Normal(cp, cp*σ_p)

to

OUT ~ @. Normal(cp, cp*σ_p)

or alternatively, rename the OUT column in the dataframe to CONC.

2 Likes

Thank you! it is working now.

hi Siel,

Welcome to the community. It seems that you are using an old 1.1 version of Pumas. There is a new 2.0 version that you can get access from our website at pumas.ai Just wanted to let you know.

Best,
Vijay