xsimplex: Generates all points on a (p,n) simplex lattice (i.e. a...

Description Usage Arguments Examples

Description

Generates all points on a p,n simplex lattice (i.e. a p-part composition of n). Each point is represented as x, a p-dimensional vector of nonnegative integers that sum to n. If argument "fun" is not null, applies a function given by the argument to each point. If simplify is FALSE, returns a list; else returns a vector or an array. "..." are passed unchanged to function given by argument fun, if any.

Usage

1
xsimplex(p, n, fun=NULL, simplify=TRUE, ...)

Arguments

p

first parameter of lattice description

n

second parameter of lattice description

fun

function to be applied pointwise

simplify

logical: if FALSE, value is a list, otherwise a vector or array

...

parameters to be passed to fun

Examples

1
2
#Compute Multinomial(n = 4, pi = rep(1/3, 3)) p.f.:
   xsimplex(3, 4, dmnom, prob=1/3)

Example output

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

 [1] 0.01234568 0.04938272 0.04938272 0.07407407 0.14814815 0.07407407
 [7] 0.04938272 0.14814815 0.14814815 0.04938272 0.01234568 0.04938272
[13] 0.07407407 0.04938272 0.01234568

combinat documentation built on May 2, 2019, 5:57 a.m.

Related to xsimplex in combinat...