Learn R Programming

OptHoldoutSize (version 0.1.0.1)

gen_resp: Generate response

Description

Generate random outcome (response) according to a ground-truth logistic model

Usage

gen_resp(X, coefs = NA, coefs_sd = 1, retprobs = FALSE)

Value

Vector of length as first dimension of dim(X) with outcome classes (if retprobs==FALSE) or outcome probabilities (if retprobs==TRUE)

Arguments

X

Matrix of observations

coefs

Vector of coefficients for logistic model. If NA, random coefficients are generated. Defaults to NA

coefs_sd

If random coefficients are generated, use this SD (mean 0)

retprobs

If TRUE, return class probability; otherwise, return classes. Defaults to FALSE

Examples

Run this code

# See examples for model_predict

Run the code above in your browser using DataLab