rmreg: Generate data from a mixture of regression model

View source: R/tools_generator.R

rmregR Documentation

Generate data from a mixture of regression model

Description

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

Usage

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

Details

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

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


comeetie/greed documentation built on Oct. 10, 2022, 5:37 p.m.