update-methods: update

Description Usage Arguments Details Value Author(s) See Also

Description

The function update will update and refit a PointProcessModel and a MultivariatePointProcess.

Usage

1
2
3
4
5
## S4 method for signature 'PointProcessModel'
update(object, formula = NULL, warmStart = TRUE, fit = TRUE, lambda = NULL, ...)

## S4 method for signature 'MultivariatePointProcess'
update(object, formula = NULL, ...)

Arguments

object

the PointProcessModel object to be updated.

formula

Changes to the formula - see update.formula for details. The default value NULL results in a refit of the model.

warmStart

a logical. Specifies if the optimization should use the previously estimated values of the parameters from the original model, if possible, as initial values. Default is TRUE.

fit

a logical. Should the model be refitted. Default value is TRUE.

lambda

a numeric. Either a vector or a single numeric specifying the penalization weight on the different parameters. Default value is NULL, which means no penalization.

...

additional arguments to the call. Passed on to ppmFit.

Details

This function is used to update and refit a model of class PointProcessModel or MultivariatePointProcess as an alternative to constructing a new model object by calling the function pointProcessModel directly.

A call of update without specifying the formula will refit the model without recomputing the model matrix. Combined with setting the coefficients of the model object this can be used to try different initial values for the numerical optimization algorithm. Also, additional (alternative) arguments can be given, which are passed on to ppmFit and ultimately to optim.

If possible, the updated model will reuse (parts of) the model matrix and thus not recompute the entire model matrix as would happen by a direct call to pointProcessModel. Reuse will happen if the updated model is a submodel of the original model and will reduce computation time as well as memory usage. For large data sets and/or many linear predictors the model matrix becomes very large, and the time to compute the matrix can be considerable. Most notably, by using update the model matrix is copied by reference from the original model to the submodel, and thus does not take up memory twice. When investigating several models that are all submodels of a single supermodel it is therefore recommended to fit the supermodel first and use update to fit the different submodels.

The current implementation of update works by using the assignment of columns in the model matrix to terms in the formula. This assignment is given by the attribute assign to the model matrix. A new model is identified as a submodel if all terms in the new model are terms in the original model. The definition used is that the updated model matrix consists of the columns that are assigned to a term in the new model. A consequence of this is that the updated model may not be parametrized as expected nor as if the model was specified using pointProcessModel. This is in particular the case when interactions are included, in which case a warning is currently given when using update. There are also other cases, in particular if one removes the intercept, where the updated model may not be as expected. At a deeper level these issues are due to the contrasts used when including factors in the orginal formula specification. Nothing is currently done in the code to deal with this. To avoid obvious pitfalls, don't remove a term using update if there is a higher order term involving the same variable(s). In particular, don't remove the intercept if there are factors in the model and don't remove a factor if it is included in an interaction.

For any submodel the model matrix is given by reference to the full model matrix of the supermodel. Therefore, a call to getModelMatrix for a submodel will return a subset of columns from the full model matrix. Consequently, the references in the attribute assign are to the terms in the full model formula and not the terms in the submodel formula. The full model formula is stored in the attribute formula of the model matrix. The attributes are intended for internal use in update primarily. It is recommended that they are not relied upon for other usages.

Value

An object of class PointProcessModel or MultivariatePointProcess containing the estimated parameters after the update.

Author(s)

Niels Richard Hansen, Niels.R.Hansen@math.ku.dk

See Also

update, update.formula, pointProcessModel, PointProcessModel


ppstat documentation built on May 2, 2019, 5:26 p.m.