Learn R Programming

aster2 (version 0.1)

Transform: Change-of-Parameter Functions for Aster Models

Description

Calculate a change-of-parameter for a saturated aster model or the derivative of such a change-of-parameter. Validate certain parameter vectors.

Usage

transformSaturated(parm, data, from = c("theta", "phi", "xi", "mu"),
  to = c("theta", "phi", "xi", "mu"), differential,
  tolerance = 8 * .Machine$double.eps)
transformConditional(parm, modmat, data, from = "beta",
  to = c("theta", "phi", "xi", "mu"), differential,
  offset, tolerance = 8 * .Machine$double.eps)
transformUnconditional(parm, modmat, data, from = c("beta", "tau"),
  to = c("beta", "theta", "phi", "xi", "mu", "tau"),
  differential, offset, tolerance = 8 * .Machine$double.eps)
jacobian(parm, data,
    transform = c("saturated", "conditional", "unconditional"),
    from = c("beta", "theta", "phi", "xi", "mu", "tau"),
    to = c("beta", "theta", "phi", "xi", "mu", "tau"),
    modmat, offset, tolerance = 8 * .Machine$double.eps)
validtheta(data, theta, tolerance = 8 * .Machine$double.eps)
is.validtheta(data, theta, tolerance = 8 * .Machine$double.eps)
validxi(data, xi, tolerance = 8 * .Machine$double.eps)
is.validxi(data, xi, tolerance = 8 * .Machine$double.eps)

Arguments

Value

a numeric vector of the same length as parm. The new parameter if deriv == FALSE or the transform of the differential if deriv = TRUE. See details.

Details

If differential is missing, the returned value is a new parameter vector of the specified type. If differential is not missing, the returned value is the derivative evaluated at parm and differential, that is, if $f$ is the change-of variable function and $\psi$ is the from parameter, then $f(\psi)$ is calculated when the differential is missing and $f'(\psi)(\delta)$ is calculated when the differential $\delta$ is not missing, where the latter is defined by $$f(\psi + \delta) \approx f(\psi) + f'(\psi)(\delta)$$ for small $\delta$.

The kinds of parameters are "theta" the conditional canonical parameter for the saturated model, "phi" the unconditional canonical parameter for the saturated model, "xi" the conditional mean value parameter for the saturated model, "mu" the unconditional mean value parameter for the saturated model, "beta" the regression coefficient parameter for a canonical affine submodel ($\theta = a + M \beta$ for a conditional canonical affine submodel or $\varphi = a + M \beta$ for an unconditional canonical affine submodel, where $a$ is the offset vector and $M$ is the model matrix), "tau" the mean value parameter for an unconditional canonical affine submodel ($\tau = M^T \mu$, where $M$ is the model matrix).

Only the conditional canonical parameter vector $\theta$ and the conditional mean value parameter vector $\xi$ can be checked directly. (To check the validity of another parameter, transform to one of these and check that.) This means that in conversions to these parameters the output vector is checked rather than the input vector, and conversions (apparently) not involving these parameters (which do go through these parameters inside the transformation function) a conversion to one of these parameters is what is checked rather than the input vector.

The function jacobian turns the derivative considered as a linear transformation calculated by the transform functions into the matrix that represents the linear transformation (sometimes called the Jacobian matrix of the transformation). The arguments modmat and offset are only used if transform == "conditional" or transform == "unconditional", and (as with the transform functions) the argument offset may be missing, in which case the zero vector is used. Not all of the candidate values for from and to arguments for the jacobian function are valid: the value must be valid for the transform function that will be called.

See Also

asterdata

Examples

Run this code
data(echinacea)
theta <- rnorm(nrow(echinacea$redata), 0, 0.1)
phi <- transformSaturated(theta, echinacea, from = "theta", to = "phi")
## rarely (if ever) want jacobian for unsaturated model transform
## result here is 5130 by 5130 matrix
jack <- jacobian(theta, echinacea, from = "theta", to = "phi")

Run the code above in your browser using DataLab