incomplete.generator: Incomplete data generator

View source: R/generator.R

incomplete.generatorR Documentation

Incomplete data generator

Description

Generate a matrix with missing values, where the indices of missing values are uniformly randomly distributed in the matrix.

Usage

incomplete.generator(m, n, r, snr = 3, prop = 0.5, seed = 1)

Arguments

m

the rows of the matrix.

n

the columns of the matrix.

r

the rank of the matrix.

snr

the signal-to-noise ratio in generating the matrix. Default snr = 3.

prop

the proportion of missing observations. Default prop = 0.5.

seed

the random seed. Default seed = 1.

Details

We generate the matrix by UV + ε, where U, V are m by r, r by n matrix satisfy standard normal distribution. ε has a normal distribution with mean 0 and variance \frac{r}{snr}.

Value

A matrix with missing values.

Examples

m <- 100
n <- 100
r <- 10
x_na <- incomplete.generator(m, n, r)
head(x_na[, 1:6])

eimpute documentation built on Oct. 22, 2022, 9:05 a.m.