Learn R Programming

SpatialNP (version 1.1-5)

to.shape: Rescale a matrix to a shape matrix

Description

This function rescales a given matrix such that its determinant, trace or the value of the first diagonal element meets a criteria.

Usage

to.shape(M, determ, trace, first)

Arguments

M

a matrix to be scaled

determ

required value for determinant

trace

required value for trace

first

required value of the first diagonal element

Value

The rescaled matrix

Details

If determ, trace or first is given M is scaled such that its determinant, trace or first diagonal element, respectively, equals that value. If none of the three is given M is scaled such that its determinant equals one. If more than one criteria is given the first of them is used and the others silently ignored.

References

Paindaveine D. (2008) A Canonical Definition of Shape. Statistics and Probability Letters 78, 2240-2247

Examples

Run this code
# NOT RUN {
(A<-matrix(c(1,2,-3,4,3,-2,-1,0,4),ncol=3))
to.shape(A%*%t(A))
to.shape(A%*%t(A),trace=3)
to.shape(A%*%t(A),first=1)

# }

Run the code above in your browser using DataLab