gen_data: Generate both the covariates and the outcomes

Description Usage Arguments Value

View source: R/simulation-lib.R

Description

Generates X using gen_dist and then generates Y = beta_0 + XB + eps, #' where eps is generated according to error_dist. NOT exported to the user.

Usage

1
gen_data(n, true_betas, gen_dist = gen_xs_default, error_dist = rnorm, ...)

Arguments

n

Number of observations

true_betas

A vector of true values of regression coefficients. Should include the intercept as the first item, beta1 as the second, etc.

gen_dist

A function specifiying how to generate the covariates. Should take n as its first argument, corresponding to the number of observations, and p as the second, corresponding to the number of dimensions per observation (including the intercept, so each X_i has p-1 dimensions).

error_dist

A function specifying how to generate the errors. Should take n as the first argument, specifying the number of observations

...

Additional arguments to gen_dist

Value

A list lst, with element lst$xs corresponding to the covariates and lst$ys corresponding to the responses.


shiandy/methods1proj documentation built on Dec. 31, 2020, 5:15 a.m.