missDeaths (version 2.7)

md.sample: md.sample

Description

Creates information of a covariate that represents a random sample (with replacement) of the provided values. This function call must be added to the md.simparams object.

Usage

md.sample(name, array, weights=NULL)

Arguments

name

name of the covariate

array

vector of elements from which to choose from

weights

vector of probability weights for obtaining the elements of the vector being sampled or NULL if all values have equal probabilities

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
library(missDeaths)

sim = md.simparams() +
   md.sample("X", c(0, 1, 2), c(0.2, 0.3, 0.5)) 
# }

Run the code above in your browser using DataCamp Workspace