Learn R Programming

refund (version 0.1-40)

generate_scalar_covariate: Generate scalar covariate

Description

Generate scalar covariates of various types for use in simulations.

Usage

generate_scalar_covariate(n, type = "normal", levels = 3, seed = NULL)

Value

For "normal" or "uniform": numeric vector of length n. For "factor": factor of length n.

Arguments

n

Integer, number of observations.

type

Character string specifying distribution: "normal", "uniform", or "factor".

levels

For type = "factor", integer number of factor levels (default 3).

seed

Optional integer seed for reproducibility within this call.