@covariates not working

I have a model
I define the


@covariates begin
        CLS
        V1S
        kshd
    end

and then use CLS in my dynamic section
I get message that: Unknown symbol CLS detected

If I define CLS =1 in @pre, model loads properly

I think something is not reading the covariates. This model used to work fine

Thanks,

A

Hi @alewolf

Two versions of Pumas ago we changes the handling of covariates to avoid inefficient handling of time varying covariates. We had some different trade-offs to make there, and one of the results of those design choices ended up being that you need to define the variables that you want to use in your dynamics block in the pre block. This includes covariates. This is usually not a problem, because a lot of times you’re going to use your covariates to construct coefficients for your ODEs, but it comes up in an example like yours where you seem to want to use the covariate name directly in the dynamics block.

@covariates CLS V1S kshd

@dynamics begin
    X' = -X/CLS + V1S/kshd*Y
    Y' = -V1S/kshd*Y
end

(okay, I just made something up, I’m not sure what your context is) no longer works. You have to do something like

@covariates CLS V1S kshd

@pre begin
    a = 1/CLS
    b = V1S/kshd
end

@dynamics begin
    X' = -a*X + b*Y
    Y' = -b*Y
end

Try to see if something similar doesn’t work for you.

There’s a rather long list of reasons why this makes many of the internals better, but the most important thing to know is just that this is how it works, and it gave an increase in runtime for time-varying covariates that I’m sure you’ll appreciate :slight_smile: We’re doing some of these breaking changes now (though I actually think this has been like this since Feb) to be in a position to provide a stable product after v1.0 is released.

Very soon we’ll do a documentation and tutorial sprint and we’ll have much better examples up.

3 Likes

Thanks so much for the help -
This makes so much sense and now I can load my model.
I think you guys are doing an awesome job with this package.
I’m changing jobs, and don’t know how much more PKPD work I’ll be doing, but I am recommending my current company to move their efforts to Pumas :slight_smile:

Take care,

A

2 Likes