Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

misclass

Generates misclassified data


Description

Takes a data.frame and produces misclassified data. Probabilities for the missclassification are given in mc.matrix.

Usage

misclass(data.org, mc.matrix, k = 1)

Arguments

data.org

data.frame containing the factor variables. Must be factors.

mc.matrix

a list of matrices giving the probabilities for the misclassification. Names of the list must correspond to the variable names in data.org. The colnames must be named according to the factor levels.

k

the exponent for the misclassification matrix

Value

A data.frame containing the misclassified variables

Author(s)

Wolfgang Lederer, wolfgang.lederer@gmail.com

See Also

Examples

x1 <- factor(rbinom(100, 1, 0.5))
x2 <- factor(rbinom(100, 2, 0.5))

p1 <- matrix(c(1, 0, 0, 1), nrow = 2)
p2 <- matrix(c(0.8, 0.1, 0.1, 0.1, 0.8, 0.1, 0.1, 0.1, 0.8), nrow = 3)

colnames(p1) <- levels(x1)
colnames(p2) <- levels(x2)

x <- data.frame(x1 = x1, x2 = x2)
mc.matrix <- list(x1 = p1, x2 = p2)

x.mc <- misclass(data.org = x, mc.matrix = mc.matrix, k = 1)

identical(x[, 1], x.mc[, 1]) # TRUE
identical(x[, 2], x.mc[, 2]) # FALSE

simex

SIMEX- And MCSIMEX-Algorithm for Measurement Error Models

v1.8
GPL-3
Authors
Wolfgang Lederer [cre, aut], Heidi Seibold [aut], Helmut Küchenhoff [ctb], Chris Lawrence [ctb], Rasmus Froberg Brøndum [ctb]
Initial release
2019-07-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.