Rng in sample_randeffs error


Could I get some assistance with the following code and error?

rand_effs = [sample_randeffs(rng=rng, sim_model_abs0_1cmt_pl_PBE, (params_PBE_sim..., tvtr_ratio = input_tr_ratio)) for subject in pop]
ERROR: MethodError: no method matching sample_randeffs(::PumasModel{(tvtr_ratio = 1, tvCL = 1, tvVc = 1, tvDuration = 1, ωCL_BSV = 1, ωVc_BSV = 1, ωduration_BSV = 1, σ_add = 1, σ_prop = 1), 3, (:Central,), ParamSet{NamedTuple{(:tvtr_ratio, :tvCL, :tvVc, :tvDuration, :ωCL_BSV, :ωVc_BSV, :ωduration_BSV, :σ_add, :σ_prop), NTuple{9, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#19#28", Pumas.TimeDispatcher{var"#20#29", var"#21#30"}, Pumas.TimeDispatcher{var"#22#31", var"#23#32"}, var"#25#34", Central1, var"#26#35", var"#27#36", Nothing}, ::NamedTuple{(:tvCL, :tvVc, :tvDuration, :ωCL_BSV, :ωVc_BSV, :ωduration_BSV, :σ_add, :σ_prop, :tvtr_ratio), Tuple{Int64, Int64, Float64, Float64, Float64, Float64, Float64, Float64, Float64}}; rng=TaskLocalRNG())
Closest candidates are:
  sample_randeffs(::Pumas.AbstractPumasModel, ::Any...) at /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/models/model_api.jl:630 got unsupported keyword argument "rng"

I also tried copying the way it was written in the docs, but that also errored.

Replace rng = rng with just rng. This is a so-called positional argument not keyword argument. With positional arguments, there is no name = value, you just use value and the order of arguments matters. With keyword arguments, you use name = value and order doesn’t matter. Keyword arguments should only be used after all positional arguments, e.g. f(x1, x2; x3 = x3) is ok but f(x3 = x3, x1, x2) is not.

1 Like