weighted_mean_sd: Helper function to compute weighted mean and standard...

View source: R/glmnetFlex.R

weighted_mean_sdR Documentation

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 documentation built on Aug. 22, 2023, 9:12 a.m.