Error while running working example

i have tried running a workshop example ( Problem 1: Simulate a first-order absorption model with linear elimination after a 100 mg oral dose in 24 subjects)

i am getting error in this part
Part 2: Perform a model fit

res = fit(mymodel,data,param,Pumas.FOCEI())
single_dose_regimen = DosageRegimen(100, time=0)

s1 = Subject(id=1, evs=single_dose_regimen,cvs=(Wt=70,))

choose_covariates() = (Wt = rand(55:80),)

pop = Population(map(i -> Subject(id = i,evs = single_dose_regimen, cvs =  choose_covariates()),1:24))

mymodel = @model begin
  @param   begin
    tvcl ∈ RealDomain(lower=0, init = 1.0)
    tvv ∈ RealDomain(lower=0, init = 20)
    tvka ∈ RealDomain(lower = 0, init= 1)
    Ω ∈ PDiagDomain(init=[0.09,0.09, 0.09])
    σ_prop ∈ RealDomain(lower=0,init=0.04)

  @random begin
    η ~ MvNormal(Ω)

  @pre begin
    CL = tvcl * (Wt/70)^0.75 * exp(η[1])
    V  = tvv * (Wt/70) * exp(η[2])
    Ka = tvka * exp(η[3])
  @covariates Wt

  @dynamics OneCompartmentModel
    #@dynamics begin
    #    Depot' =  -Ka*Depot
    #    Central' =  Ka*Depot - (CL/V)*Central

  @derived begin
      cp = @. 1000*(Central / V)
      dv ~ @. Normal(cp, sqrt(cp^2*σ_prop))

param = init_param(mymodel)

obs = simobs(mymodel, pop, param, obstimes=0:1:72)

simdf = DataFrame(obs)
first(simdf, 6)

simdf.route = "ev"

timeu = u"hr"
concu = u"mg/L"
amtu  = u"mg"

ncadf = read_nca(simdf, id=:id, time=:time, conc=:cp, amt=:amt,
    route=:route,timeu=timeu, concu=concu, amtu=amtu, lloq=0.4concu)


auc = NCA.auc(ncadf)

cmax = NCA.cmax(ncadf)

report = NCAReport(ncadf)
report = NCA.to_dataframe(report)

simdf.cmt = ifelse.(ismissing.(simdf.cmt), 2, simdf.cmt)
est_df = simdf[.!((simdf.dv .== 0.0) .& (simdf.cmt .==2)),:]

data = read_pumas(est_df ,cvs = [:Wt], dvs=[:dv])

res = fit(mymodel,data,param,Pumas.FOCEI())

Hi Sai,

Can you post what’s the error that you are getting?


i am able to run fit …
now im got an error while running infer(res)infer(res)

I’m unable to reproduce this. Which version of Pumas and JuliaPro are you using. Also, does the error persist if you rerun the program?

itz juliapro1.2.0-1,
and and re run the program and got same error

Which version of Pumas are you using? You can see it if you write ] status or Pkg.status().

(v1.2) pkg> status
    Status `C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\environments\v1.2\Project.toml`
  [c52e3926] Atom v0.9.1
  [336ed68f] CSV v0.5.12
  [a93c6f00] DataFrames v0.19.4
  [7073ff75] IJulia v1.19.0
  [e5e0dc1b] Juno v0.7.1
  [91a5bcdd] Plots v0.26.3
  [4f2c3c20] Pumas v0.4.0
  [8bb1440f] DelimitedFiles
  [37e2e46d] LinearAlgebra

You are not using the latest version of Pumas. Could you please try ] up Pumas or Pkg.update("Pumas") and then restart Julia and rerun your code?

Sure. Thankyou very much