transform: Change-of-Parameter Functions for Aster Models

Description Usage Arguments Details Value See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
transformSaturated(parm, data, from = c("theta", "phi", "xi", "mu"),
  to = c("theta", "phi", "xi", "mu"), differential,
  model.type = c("unconditional", "conditional"),
  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, model.type = c("unconditional", "conditional"),
    tolerance = 8 * .Machine$double.eps)
is.validtheta(data, theta, model.type = c("unconditional", "conditional"),
    tolerance = 8 * .Machine$double.eps)
validxi(data, xi, model.type = c("unconditional", "conditional"),
    tolerance = 8 * .Machine$double.eps)
is.validxi(data, xi, model.type = c("unconditional", "conditional"),
    tolerance = 8 * .Machine$double.eps)

Arguments

parm

parameter vector to transform, a numerical vector of length nrow(data$redata) for transformSaturated or of length ncol(modmat) for transformConditional and transformUnconditional.

data

an object of class "asterdata" produced by asterdata or “by hand” such that is.validasterdata(data) returns TRUE. The specification of the aster model.

from

the kind of parameter which parm is. May be abbreviated.

to

the kind of parameter to which parm is to be converted. May be abbreviated.

differential

if not missing a numeric vector of the same length as parm. If missing the change-of-parameter is calculated. If not missing the directional derivative of the change-of-parameter is calculated (see Details section).

modmat

the model matrix for a canonical affine submodel, a numerical matrix having nrow(data$redata) rows and length(beta) columns for transformConditional or length(parm) columns for transformUnconditional.

offset

the offset vector for a canonical affine submodel, a a numerical vector of length nrow(data$redata). May be missing, in which case offset vector equal to zero is used.

theta

conditional canonical parameter vector to validate, a numerical vector of length nrow(data$redata).

xi

conditional canonical parameter vector to validate, a numerical vector of length nrow(data$redata).

model.type

which kind of model (see Details section). May be abbreviated.

tolerance

numeric >= 0. Relative errors smaller than tolerance are not considered in checking validity of xi for multinomial data.

transform

the “transform” function that will be called to calculate derivatives, e. g., transform == "saturated" means the function transformSaturated will be called. May be abbreviated.

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 phi = 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.

There is a difference between conditional and unconditional aster models in the way they treat zero predecessors. For a conditional aster model, if the observed value of the predecessor is zero, then the successor is zero almost surely and can have any parameter value for theta or xi. For an unconditional aster model, if the expected value of the predecessor is zero, then the successor is zero almost surely and can have any parameter value for theta or xi.

Since zero values are not allowed at initial nodes (not considered valid by the function validasterdata), the only way predecessor data can be zero almost surely in an unconditional aster model is if the delta vector (data$redelta) is not zero so we have a limiting model.

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.

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.

See Also

asterdata

Examples

1
2
3
4
5
6
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
## Not run: jack <- jacobian(theta, echinacea, from = "theta", to = "phi")

aster2 documentation built on May 2, 2019, 11:02 a.m.