Skip to contents

The model({}) form of ini({})'s dist() line:

Usage

# S3 method for class 'dist'
rxUdfUiLhs(fun, rhs)

Arguments

fun

the dist(<eta>) call

rhs

the declared distribution, eg dgamma(shape=a, rate=b)

Value

rxUdfUiLhs() list: the modified iniDf and the inverse-CDF line that replaces the declaration

Details

dist(eta.cl) ~ dgamma(shape = 1/exp(lclrv), rate = 1/(exp(lclrv)*aCl))

Reached through rxUdfUiLhs(), a user-function dispatch on the LEFT of a model line – dist(eta.cl) is not rxode2 grammar and ~ is already overloaded, so the UI claims the whole line before rxode2 ever sees it.

The point of the model-block form is that a distribution parameter can be any expression the model has already computed, including one built from covariates:

aCl <- exp(lclm + bWT*(WT - 70))
dist(eta.cl) ~ dgamma(shape = 1/exp(lclrv), rate = 1/(exp(lclrv)*aCl))

The ini({}) form cannot express that – it is parsed before the model block exists, so its arguments can only name population parameters. This one emits the inverse-CDF line IN PLACE, at the declaration, so everything above it is in scope.

What it leaves for rxEtaDistExpand() is the part that needs the whole picture rather than one line: the latent normals, the Gaussian copula that correlates them, and the rxCor.* thetas. Those are prepended, so the rxN.* this line reads are defined above it.

Author

Matthew L. Fidler