# subsetMatrix: Matrix of Subset Indicators In rje: Miscellaneous Useful Functions for Statistics

 subsetMatrix R Documentation

## Matrix of Subset Indicators

### Description

Produces a matrix whose rows indicate what subsets of a set are included in which other subsets.

### Usage

```subsetMatrix(n)
```

### Arguments

 `n` integer containing the number of elements in the set.

### Details

This function returns a matrix, with each row and column corresponding to a subset of a hypothetical set of size `n`, ordered lexographically. The entry in row `i`, column `j` corresponds to whether or not the subset associated with `i` is a superset of that associated with `j`.

A 1 or -1 indicates that `i` is a superset of `j`, with the sign referring to the number of fewer elements in `j`. 0 indicates that `i` is not a superset of `j`.

### Value

An integer matrix of dimension 2^n by 2^n.

### Note

The inverse of the output matrix is just `abs(subsetMatrix(n))`.

### Author(s)

Robin Evans

`combinations`, `powerSet`, `designMatrix`.

### Examples

```
subsetMatrix(3)

```

rje documentation built on Nov. 12, 2022, 9:06 a.m.