Learn R Programming

refund (version 0.1-37)

pco_predict_preprocess: Make predictions using pco basis terms

Description

This function performs the necessary preprocessing for making predictions with [mgcv]{gam} models that include {pco} basis terms. The function pco_predict_preprocess builds a data.frame (or augments an existing one) to be used with the usual predict function.

Usage

pco_predict_preprocess(model, newdata = NULL, dist_list)

Value

a {data.frame} with the coordinates for the new data inserted into principal coordinate space, in addition to the supplied

newdata if this was non-NULL. This can be used as the

newdata argument in a call to [mgcv]{predict.gam}.

Arguments

model

a fitted [mgcv]{gam} model with at least one term of class "pco.smooth".

newdata

data frame including the new values for any non-{pco} terms in the original fit. If there were none, this can be left as NULL.

dist_list

a list of n \(\times\) n* matrices, one per {pco} term in the model, giving the distances from the n* prediction points to the n design points (original observations). List entry names should correspond to the names of the terms in the model (e.g., if the model includes a s(x) term, dist_list must include an element named "x").

Author

David L Miller

Details

Models with {pco} basis terms are fitted by inputting distances among the observations and then regressing (with a ridge penalty) on leading principal coordinates arising from these distances. To perform prediction, we must input the distances from the new data points to the original points, and then "insert" the former into the principal coordinate space by the interpolation method of Gower (1968) (see also Miller, 2012).

An example of how to use this function in practice is shown in {smooth.construct.pco.smooth.spec}.

References

Gower, J. C. (1968). Adding a point to vector diagrams in multivariate analysis. Biometrika, 55(3), 582-585.

Miller, D. L. (2012). On smooth models for complex domains and distances. PhD dissertation, Department of Mathematical Sciences, University of Bath.

See Also

{smooth.construct.pco.smooth.spec}