nlmixrdevelopment / nlmixr

nlmixr: an R package for population PKPD modeling
https://nlmixrdevelopment.github.io/nlmixr/
GNU General Public License v2.0
115 stars 45 forks source link

Feature Request: SEs on estimated covariance/standard deviation components. #248

Closed mattfidler closed 5 years ago

mattfidler commented 5 years ago

See Issue #243 for discussion.

mattfidler commented 5 years ago

Hi @billdenney

This is to collect my thoughts as well as to explain the current state of things in nlmixr. Since you requested it I am tagging you.

Why Standard Error on the Covariates

I could see where standard errors or variances on covariances/correlations would be useful because:

What is going on currently in nlmixr

Currently as it stands:

Possibility for standard errors in FOCEi

For focei calculation of standard errors could be turned on, however:

Simulation approaches with and without standard errors

This details sampling from the uncertainty in the parameter estimates themselves.

Approach 1 - simulating with only the standard errors

In this approach a multivariate normal is used to simulate the variance and covariance components that are estimated. Even with the transformations discussed in the FOCEi section, the co-variance could be calculated from the simulations and simulated from for each "study".

Advantages

Disadvantages

Approach 2 -- Simulating with the standard errors of the variance components and the LKJ distribution for the covariance pieces.

This is the approach that stan advocates.

In this approach a multivariate normal is used to simulate the fixed effect variance components that are estimated. Once the variance components are simulated, the correlation is simulated by the LKJ distribution and the covariance is constructed from the caluclated pieces.

Advantages

Disadvantages

Some of these objections can be overcome by using the inverse wishart to simulate the correlation matrix instead of the LKJ distribution. Then:

But it is slower than the LKJ distribution.

Inverse Wishart

This is the approach that RxODE currently uses.

Advantages:

Other approaches for prior specification of covariance matrix

These include (and are discussed here)

mattfidler commented 5 years ago

If I implement standard errors on the covariance matrix, then a simulation strategy could be:

However it is simpler to explain and simply use inverse wishart, so perhaps that could also be an option for simulation.

mattfidler commented 5 years ago

One other note, the etaLJK parameter can be related to degrees of freedom see: https://arxiv.org/pdf/1809.04746.pdf

alpha_{d-1} = (nu - d +1)/2 = etaLJK + (d -2)/2
etaLJK = (nu-d+1)/2 - (d-2)/2 = (nu-1)/2

Which also implies you need at least nu=3 degrees of freedom.

billdenney commented 5 years ago

WOW! Thank you for the details here. They are eye-opening (and very well described).

I can't claim to have an understanding of what the best method is, but your summary gives a lot of thought to items to consider. I do maintain the desire to simulate with parameter uncertainty, but I now feel like we as a discipline are often doing that wrong (when we do it) for the omega matrix.

mattfidler commented 5 years ago

I agree; before working on this nlmixr project I never considered the omega matrix simulation in this detail. @wwang-at-github is the one who told me about the inverse wishart in the first place.

Overall I think the inverse wishart is the most flexible since it can handle modeled covariance terms and is the default for RxODE simulations.

If that is a good way to simulate covariances, the SE terms become unneeded parameters (except for possibly diagnosing model problems). If you use SEs in prior distribution via one of the above methods, SEs on covariance terms may not be needed (although because of the parameterization, the covariance terms could affect the variance terms so I have to think carefully about excluding them...)

mattfidler commented 5 years ago

The following publication seems to support when covariances are modeled it is reasonable to use an inverse wishart, though the separation strategy is preferred otherwise

https://files.eric.ed.gov/fulltext/ED588080.pdf

mattfidler commented 5 years ago

This publication shows a way to simulate a full covariance prior but would require a mixture model through mcmc fitting, so I think it is too much:

https://academic.oup.com/biomet/article/91/1/1/218709

mattfidler commented 5 years ago

Here is my current thinking:

With all that in mind, I am thinking not adding SEs on estimated covariance/standard deviation components for now.

However, the simulation methodologies now exist in the development branch of RxODE.

billdenney commented 5 years ago

That makes perfectly good sense, and thank you for the thoughtful and detailed discussion.