rmreg returns an X matrix, a y vector and the cluster labels generated randomly with a Mixture of regression model.

rmreg(
  N,
  pi,
  A,
  sigma,
  X = cbind(rep(1, N), matrix(stats::rnorm(N * (ncol(A) - 1)), N, ncol(A) - 1))
)

Arguments

N

A numeric value the size of the graph to generate

pi

A numeric vector of length K with clusters proportions (must sum up to 1)

A

A numeric matrix of dim K x d with the regression coefficient

sigma

A numeric of length 1 with the target conditional variance

X

A matrix of covariate

Value

A list with fields:

  • X: the covariate matrix

  • y: the target feature

  • K: number of generated clusters

  • N: sample size

  • cl: vector of clusters labels

  • pi: clusters proportions

  • A: regression coefficients used in the simulation

  • sigma: conditional variance

Details

It takes the sample size, cluster proportions and regression parameters matrix and variance as input accordingly