to.shape: Rescale a matrix to a shape matrix

to.shapeR Documentation

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

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.

Value

The rescaled matrix

Note

A shape matrix is symmetric and positive definite square matrix. In order for the result to be such the argument matrix M should also be symmetric and positive definite square matrix. However, the function does not check for this. Expect to see errors if M is of inappropriate type.

Author(s)

Seija Sirkia, seija.sirkia@iki.fi

References

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

Examples

(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)


SpatialNP documentation built on March 18, 2022, 8:02 p.m.