generate_mixture: Generate a mixture dataset

Description Usage Arguments Value Examples

View source: R/0-utils.R

Description

This function creates a dataset with $n$ rows, $p$ predictors and $k$ classes, for simulation of a mixture or logisitc regression models.

Usage

1
2
generate_mixture(n, p, k, beta = matrix(runif(k * p, -2, 2), nrow = k),
  ak = generate_probability_vector(k))

Arguments

n

Number of observations

p

Number of predictors for each individual logistic regression model

k

Number of classes

beta

A $k$ by $p$ matrix with the true regression coefficients for each mixture component

ak

A vector of length k summing to 1 for the mixture probabilties

Value

A list containing slots data and params containing the simulated data and the true parameters respectively

Examples

1
2
3
generate_mixture(100, 3, 2)
generate_mixture(100, 2, 1)
generate_mixture(10^4, 4,6)

Nth-iteration-labs/ofmlr documentation built on Sept. 27, 2020, 9:49 p.m.