Not getting graph for VPC

Hi
i see a graph for VPC in working examples . i run some codes for my data and same as working example as well but i’m not able to get any graph for VPC. even i have a confusion about vpc code please tell me which is correct one either vpc(res1,3) or
vpc(res1,3) |> plot

please help me with this

md = CSV.read("D:\\NONMEMnights\\mould\\julia\\12.3.2\\2comp_iv_data.csv", missingstring=".")

trans = read_pumas(md, id=:id, time=:TIME, dvs=[:dv],)

dian = @model begin
  @param   begin
    tvcl ∈ RealDomain(lower=0, init = 1.0)
    tvv ∈ RealDomain(lower=0, init = 20)
    tvQ ∈ RealDomain(lower = 0, init= 1)
    tvv2 ∈ RealDomain(lower = 0, init = 100)
    Ω ∈ PDiagDomain(init=[0.1])
    σ_prop ∈ RealDomain(lower=0,init=0.04)
  end
#end
  @random begin
#   η ~ MvNormal(Matrix{Float64}(0.01I, 1, 1))
η ~ MvNormal(Ω)
    #η ~ MvNormal(Ω)
  end
#end
  @pre begin
    CL = tvcl * exp(η[1])
    V  = tvv
    V2 = tvv2
    Q = tvQ
  end
#end
 #@covariates WT
#end
  #@dynamics ImmediateAbsorptionModel
    @dynamics begin
        #    Depot' =  -Ka*Depot
            Central' =  Q*(Peripheral/V2) - (CL/V)*Central - Q*(Central/V)

         Peripheral' =   Q*(Central/V)-Q*(Peripheral/V2)
    end
#end
@vars begin
       Cent   =  Central/V
       Peri  =  Peripheral/V2
   end
  @derived begin
      cp = Cent
     # dv ~ @. Normal(cp,sqrt(cp^2*σ_prop))
      dv ~ @. Normal(cp, sqrt(cp^2*σ_prop)+eps())
    end
end

param =init_param(dian)

sims = simobs(dian,trans,param)
plot(sims)

res1 = fit(dian,trans,param,Pumas.FOCEI())


#infer(res1)

preds = DataFrame(predict(res1))

resids = DataFrame(wresiduals(res1))

ebes = DataFrame(empirical_bayes(res1))

resout = DataFrame(inspect(res1))

vpc(res1,3)

vpc(res1,3) |> plot

error is


vpc(res1,3)|>plot
ERROR: Cannot convert Tuple{Float64,Float64} to series data for plotting
Stacktrace:
 [1] prepareSeriesData(::Tuple{Float64,Float64}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\series.jl:15
 [2] convertToAnyVector(::Tuple{Float64,Float64}, ::Dict{Symbol,Any}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\series.jl:26
 [3] (::getfield(Plots, Symbol("##143#146")){Dict{Symbol,Any}})(::Tuple{Float64,Float64}) at .\none:0
 [4] iterate(::Base.Generator{Array{Tuple{Float64,Float64},1},getfield(Plots, Symbol("##143#146")){Dict{Symbol,Any}}}) at .\generator.jl:47
 [5] append_any(::Any, ::Vararg{Any,N} where N) at .\essentials.jl:722
 [6] convertToAnyVector(::Array{Tuple{Float64,Float64},1}, ::Dict{Symbol,Any}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\series.jl:41
 [7] (::getfield(Plots, Symbol("##143#146")){Dict{Symbol,Any}})(::Array{Tuple{Float64,Float64},1}) at .\none:0
 [8] iterate(::Base.Generator{Array{Any,1},getfield(Plots, Symbol("##143#146")){Dict{Symbol,Any}}}) at .\generator.jl:47
 [9] append_any(::Any, ::Vararg{Any,N} where N) at .\essentials.jl:722
 [10] convertToAnyVector(::Array{Any,1}, ::Dict{Symbol,Any}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\series.jl:41
 [11] process_ribbon(::Array{Any,1}, ::Dict{Symbol,Any}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\series.jl:62
 [12] macro expansion at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\series.jl:139 [inlined]
 [13] apply_recipe(::Dict{Symbol,Any}, ::Type{Plots.SliceIt}, ::Array{Float64,1}, ::Array{Any,1}, ::Nothing) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\RecipesBase\zBoFG\src\RecipesBase.jl:275
 [14] _process_userrecipes(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Pumas.VPC}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\pipeline.jl:83 [15] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Pumas.VPC}) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\plot.jl:178
 [16] #plot#133(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}, ::typeof(plot), ::Pumas.VPC) at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\plot.jl:57
 [17] plot at C:\Users\Lenovo\.juliapro\JuliaPro_v1.2.0-1\packages\Plots\h3o4c\src\plot.jl:51 [inlined]
 [18] |>(::Pumas.VPC, ::typeof(plot)) at .\operators.jl:854
 [19] top-level scope at none:0

hope i`m clear

i see a graph for VPC in working examples .

Where did you find that example? Unfortunately, VPC isn’t currently supported but we are actively working on the implementation.

Thank you Andreasnoack

please find the link of example
https://tutorials.pumas.ai/html/exercises/workshop_solutions.html

Thanks. Indeed there used to be a vpc function but it had to be adjusted and we decided to temporarily remove it until it has been fixed.

1 Like

Hi Sai,
You should be able to use vpc with the 1.0 release

1 Like