predict.lme.morph: Predict Measurements from True Values

View source: R/predict.R

predict.lme.morphR Documentation

Predict Measurements from True Values

Description

Calculates model predictions for the true size of a dimension based on true values for any subset of the remaining dimensions. Predictions for multiple individuals are available from a single call to the function.

Usage

## S3 method for class 'lme.morph'
predict(object, y.dim, newdata = NULL, type = c("lm", "pca"), ...)

Arguments

object

An object of class lme.morph, returned by fit.morph().

y.dim

Integer specifying which dimension to predict

newdata

A data frame of other dimensions to use for prediction. Column names must be of the form "dimX" where X is the dimension number.

type

Either "lm" or "pca" for the type of prediction.

...

Additional arguments passed to methods

Details

This function computes estimated coefficients for the appropriate linear function (as per summary.lme.morph() with type = "betas-lm" or type = "betas-pca"), and then evaluates the function for the provided newdata. For type = "pca", only a single column can be provided in newdata.

Value

A matrix with estimated true sizes and standard errors. Note that these are standard errors, not prediction errors.

Prediction functions in morphErr

There are three key differences between predict.lme.morph() and predictblup().

  • predict.lme.morph() only generates estimates for one dimension based on true values for other dimensions, whereas predictblup() can generate estimates from true values, observed values (i.e., subject to measurement error), or a combination of both.

  • predict.lme.morph() can generate estimates for multiple individuals, whereas predictblup() only provides estimates for a single individual.

  • predict.lme.morph() provides standard errors, but predictblup() does not.

See Also

predictblup()

Examples

## Fitting model to manta ray data.
fit <- fit.morph(manta)
## Predicting dimension 2 for a single individual with a true value
## of 90 for dimension 3.
predict(fit, y.dim = 2, newdata = data.frame(dim3 = 90))
## Predicting dimension 1 from dimensions 2 and 3 for two
## individuals, one with true values of 130 and 60 for dimensions 2
## and 3, respectively, and one with true values of 140 and 70.
predict(fit, y.dim = 1, newdata = data.frame(dim2 = c(130, 140),
                                             dim3 = c(60, 70)))


morphErr documentation built on Aug. 30, 2026, 5:06 p.m.