delete_MNAR_1_to_x: Create MNAR values using MNAR1:x

Description Usage Arguments Details Value References See Also Examples

View source: R/delete_1_to_x.R

Description

Create missing not at random (MNAR) values using MNAR1:x in a data frame or a matrix

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
delete_MNAR_1_to_x(
  ds,
  p,
  cols_mis,
  x,
  cutoff_fun = median,
  prop = 0.5,
  use_lpSolve = TRUE,
  ordered_as_unordered = FALSE,
  stochastic = FALSE,
  add_realized_x = FALSE,
  ...,
  miss_cols
)

Arguments

ds

A data frame or matrix in which missing values will be created.

p

A numeric vector with length one or equal to length cols_mis; the probability that a value is missing.

cols_mis

A vector of column names or indices of columns in which missing values will be created.

x

Numeric with length one (0 < x < Inf); odds are 1 to x for the probability of a value to be missing in group 1 against the probability of a value to be missing in group 2 (see details).

cutoff_fun

Function that calculates the cutoff values in the cols_ctrl.

prop

Numeric of length one; (minimum) proportion of rows in group 1 (only used for unordered factors).

use_lpSolve

Logical; should lpSolve be used for the determination of groups, if cols_ctrl[i] is an unordered factor.

ordered_as_unordered

Logical; should ordered factors be treated as unordered factors.

stochastic

Logical; see details.

add_realized_x

Logical; if TRUE the realized odds for cols_mis will be returned (as attribute).

...

Further arguments passed to cutoff_fun.

miss_cols

Deprecated, use cols_mis instead.

Details

The functions delete_MNAR_1_to_x and delete_MAR_1_to_x are sisters. The only difference between these two functions is the column that controls the generation of missing values. In delete_MAR_1_to_x a separate column cols_ctrl[i] controls the generation of missing values in cols_mis[i]. In contrast, in delete_MNAR_1_to_x the generation of missing values in cols_mis[i] is controlled by cols_mis[i] itself. All other aspects are identical for both functions. Therefore, further details can be found in delete_MAR_1_to_x.

Value

An object of the same class as ds with missing values.

References

Santos, M. S., Pereira, R. C., Costa, A. F., Soares, J. P., Santos, J., & Abreu, P. H. (2019). Generating Synthetic Missing Data: A Review by Missing Mechanism. IEEE Access, 7, 11651-11667

See Also

delete_MAR_1_to_x

Other functions to create MNAR: delete_MNAR_censoring(), delete_MNAR_one_group(), delete_MNAR_rank()

Examples

1
2
ds <- data.frame(X = 1:20, Y = 101:120)
delete_MNAR_1_to_x(ds, 0.2, "X", x = 3)

missMethods documentation built on July 30, 2020, 5:13 p.m.