Skip to contents

candisc and cancor objects have coefficients for the X and Y and weighted scores for these, whose signs are arbitrary, in the sense that a given column can be reflected (multiplied by -1) without changing the fit. But, often you will want to reverse the direction of one or more dimensions for ease of interpretation.

This function allows you to reflect any columns of the variable coefficients (and corresponding observation scores). This is often useful for interpreting a biplot, for example when a component (often the first) has all negative signs.

Usage

reflect(object, columns = 1:2, ...)

# S3 method for class 'data.frame'
reflect(object, columns = 1:2, ...)

# S3 method for class 'cancor'
reflect(object, columns = 1:2, ...)

# S3 method for class 'candisc'
reflect(object, columns = 1:2, ...)

Arguments

object

An object whose columns are to be reflected

columns

a vector of indices of the columns to reflect

...

Unused

Value

The object with specified columns of the variable coefficients and observation scores multiplied by -1.

Details

reflect methods are available for:

  • data.frames

  • "cancor" objects

  • "candisc" objects

Note that plot.candisc() and plot.candisc() can handle this internally using the argument rev.axes.

Methods (by class)

  • reflect(data.frame): "data.frame" method.

  • reflect(cancor): "cancor" method.

  • reflect(candisc): "candisc" method.

See also

ggbiplot::reflect has similar methods for PCA-like objects

Author

Michael Friendly