Description Usage Arguments Value Author(s) See Also Examples

Blindly fitting a model to all possible partitions is wasteful use of resources. Instead, one can rank the K levels (strata) based on expected response values to explore only K-1 binary partitions along the gradient defined by the ranks of the expected values.

1 2 |

`Y` |
numeric, vector of observations. |

`X` |
numeric, design matrix. |

`Z` |
factor, must have at least 2 unique levels. |

`dist` |
character, distribution argument passed to underlying functions,
see listed on the help page of |

`x` |
and a numeric vector. |

`collapse` |
character, what to paste between levels.
Defaults to |

`...` |
other arguments passed to the underlying functions, see |

`oComb`

returns the 'contrast' matrix based on the rank vector as input.
Ranked from lowest to highest expected value among the partitions.

The function `rankComb`

fits the model with multiple (K > 2) factor levels
to find out the ranking, and returns a binary classification matrix
as returned by `oComb`

corresponding to the ranking.

Peter Solymos <[email protected]>

`allComb`

for alternative partitioning algorithm.

`opticut`

for the user interface.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## simulate some data
set.seed(1234)
n <- 200
x0 <- sample(1:4, n, TRUE)
x1 <- ifelse(x0 %in% 1:2, 1, 0)
x2 <- rnorm(n, 0.5, 1)
lam <- exp(0.5 + 0.5*x1 + -0.2*x2)
Y <- rpois(n, lam)
## binary partitions
head(rc <- rankComb(Y, model.matrix(~x2), as.factor(x0), dist="poisson"))
attr(rc, "est") # expected values in factor levels
aggregate(exp(0.5 + 0.5*x1), list(x0=x0), mean) # true values
## simple example
oComb(1:4, "+")
## using estimates
oComb(attr(rc, "est"))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.