# Internal variables with a heavy boundary of zero

**URL:** <https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873>\
**Category:** data analysis\
**Tags:** survival-analysis\
**Created:** [February 10, 2025, 4:58am UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873 "2025-02-10T04:58:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Rich](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/matthew_rich/32/4394_2.png) [@Matthew\_Rich](https://discourse.datamethods.org/u/Matthew_Rich)\
**Post date:** [February 10, 2025, 4:58am UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/1 "2025-02-10T04:58:54Z")

</div>

Hi all,

First post! (rms and this website has been an oasis as I strive to become a better modeler)

I do PK modeling and I have a bear of a project where the data is really poor. Different assays, different disease states, you name it, it is messed up. I am still tasked with analyzing it.

I am doing an exposure response analysis with overall survival as the key endpoint. I have made a PK model, which I do not think is that great because I have so many BQL values ( roughly half the data is BQL, due to really poor clinical study design). My fits with the zeros included are terrible, better without, but I have high random effect shrinkage values. I folded this information into a TTE analysis for a cox model using average dose interval AUC as the exposure variable.

So I know my model is pretty much junk and I am really looking for a post mortem from people more skilled in the art.

My three major questions are as follows

1. How would one deal with data where there is very larger potions of zeros in the data? It skews the entire analysis. I saw some mention of joint modeling but I did not see anything like that in the RMS sections so I am wondering if there is a better way. If it is the way is there way to achieve such a model using RMS.

2. I know I lose a lot of information by averaging but the AUC is constantly changing and I was not sure how it would be integrated in the model there are not a lot of simple examples of internal variables being used in a cox hazard model to get me started. I was concerned because I guess tmerge would need an entry for each time the AUC changed which would make each subjects take up many many rows. Is this the only way to do it? Is there a better way?

3. What do you when your continuous covariate is absurdly noisy (like with too many zeros or just noisy data) that one cannot discern what’s going on. Do you bother burning degrees of freedom fitting a spline to a point cloud?

Thanks in advance

Matt

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [February 12, 2025, 10:42pm UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/2 "2025-02-12T22:42:09Z")

</div>

Lots of zeros in an X don’t necessarily ruin that part of the model, but often the residual variance needs to be allowed to be different if the zeros come from detection limit truncation. Also you might add a discontinuity for the X effect at zero.

---

<div class="post-metadata">

**Author:** ![Matthew\_Rich](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/matthew_rich/32/4394_2.png) [@Matthew\_Rich](https://discourse.datamethods.org/u/Matthew_Rich)\
**Post date:** [February 13, 2025, 12:54pm UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/3 "2025-02-13T12:54:48Z")

</div>

I apologies, left out the detail that the prevalence in zeros is in my Y! I got this data after the work had been completed and the timing of the sampling was such that they missed drug concentration completely ( basically half my data is below the detection limit).

In my literature search they suggest joint modeling. Is that something that can be accomplished with the rms package.

---

<div class="post-metadata">

**Author:** ![davidcnorrismd](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/davidcnorrismd/32/3502_2.png) [@davidcnorrismd](https://discourse.datamethods.org/u/davidcnorrismd)\
**Post date:** [February 13, 2025, 9:10pm UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/4 "2025-02-13T21:10:29Z")

</div>

Formally, one would say BQL values are [censored](https://en.wikipedia.org/wiki/Censoring_(statistics)). Bayesian methods handle such data coherently and efficiently, and of course there is a long history of Bayesian methods in PKPD.

One nice thing about PKPD is that at least you have a rich underlying theory upon which to build realistic models, and you don’t have to make recourse to theory-free empirical curve-fitting. This [paper of mine](https://arxiv.org/abs/2004.12755) shows how even a very paltry data set can be approached meaningfully, using methods for censored data.

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [February 15, 2025, 8:53pm UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/5 "2025-02-15T20:53:31Z")

</div>

> [@Matthew\_Rich](#):
>
> In my literature search they suggest joint modeling. Is that something that can be accomplished with the rms package.

No, it’s best to do that with joint Bayesian models using `Stan`.

---

<div class="post-metadata">

**Author:** ![Matthew\_Rich](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/matthew_rich/32/4394_2.png) [@Matthew\_Rich](https://discourse.datamethods.org/u/Matthew_Rich)\
**Post date:** [February 25, 2025, 1:32pm UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/6 "2025-02-25T13:32:12Z")

</div>

Thanks for the tip, I will look into that.

---

<div class="post-metadata">

**Author:** ![Matthew\_Rich](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/matthew_rich/32/4394_2.png) [@Matthew\_Rich](https://discourse.datamethods.org/u/Matthew_Rich)\
**Post date:** [February 25, 2025, 1:35pm UTC](https://discourse.datamethods.org/t/internal-variables-with-a-heavy-boundary-of-zero/25873/7 "2025-02-25T13:35:55Z")

</div>

@davidcnorrismd

Thanks for the reference I will be reading may circle back with some questions.
