Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

weighted_mean_sd

Helper function to compute weighted mean and standard deviation


Description

Helper function to compute weighted mean and standard deviation. Deals gracefully whether x is sparse matrix or not.

Usage

weighted_mean_sd(x, weights = rep(1, nrow(x)))

Arguments

x

Observation matrix.

weights

Optional weight vector.

Value

A list with components.

mean

vector of weighted means of columns of x

sd

vector of weighted standard deviations of columns of x


glmnet

Lasso and Elastic-Net Regularized Generalized Linear Models

v4.1-1
GPL-2
Authors
Jerome Friedman [aut], Trevor Hastie [aut, cre], Rob Tibshirani [aut], Balasubramanian Narasimhan [aut], Kenneth Tay [aut], Noah Simon [aut], Junyang Qian [ctb]
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.