norm_errors: Generate heteroskedastic Gaussian errors based on the norm of...

View source: R/dgp-lib-errors.R

norm_errorsR Documentation

Generate heteroskedastic Gaussian errors based on the norm of X.

Description

Generate independent Gaussian errors with variance proportional to norm of row observations in the data matrix X. That is, epsilon_i ~ N(0, scale * ||x_i||_2^2).

Usage

norm_errors(X, scale = 1)

Arguments

X

Data matrix or data frame.

scale

Multiplicative scale factor.

Value

A vector of simulated errors with length n.

Examples

errs <- norm_errors(X = iris %>% dplyr::select(-Species))


Yu-Group/dgpoix documentation built on June 3, 2022, 1:40 a.m.