CategoryVector
N+1個の頂点を持つN単体はN次元空間におさまる。その頂点座標を出す関数
N<-5
CategoryVector(N)
CategoryVector<-
function (nc = 3)
{
df <- nc - 1
d <- df + 1
diagval <- 1:d
diagval <- sqrt((df + 1)/df) * sqrt((df - diagval + 1)/(df -
diagval + 2))
others <- -diagval/(df - (0:(d - 1)))
m <- matrix(rep(others, df + 1), nrow = df + 1, byrow = TRUE)
diag(m) <- diagval
m[upper.tri(m)] <- 0
as.matrix(m[, 1:df])
}
\name{CategoryVector}
\alias{CategoryVector}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
CategoryVector
}
\description{
N+1個の頂点を持つN単体はN次元空間におさまる。その頂点座標を出す関数
}
\usage{
CategoryVector(nc=5)
}
%- maybe also 'usage' for other objects documented here.
\details{
%% ~~ If necessary, more details than the description above ~~
}
\value{
ncx(nc-1)行列
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%% ~~who you are~~
}
\note{
%% ~~further notes~~
}
%% ~Make other sections like Warning with \section{Warning }{....} ~
\seealso{
}
\examples{
# The following calculation using the simplex matrix makes diagonal values N-1 and non-diagonal values -1.
Ns<-2:10
for(i in Ns){
N<-i
X<-CategoryVector(N)
print(X%*%t(X)*(N-1))
}