weighted_mean_multivariate: Calculate the weighted mean (multivariate)

View source: R/RcppExports.R

weighted_mean_multivariateR Documentation

Calculate the weighted mean (multivariate)

Description

Calculation of weighted mean when the target is multivariate

Usage

weighted_mean_multivariate(matrix, weights, inverse_sum_weights)

Arguments

matrix

an (m x n) matrix where the ith row is the ith sample

weights

list of m matrices of the same dimension (n x n)

inverse_sum_weights

the inverse of the sum of the weights (can be calculated by passing in weights to inverse_sum_matrices)

Value

proposal mean vector

Examples

m1 <- matrix(c(1,2,3,4), nrow = 2, ncol = 2)
m2 <- matrix(c(5,6,7,8), nrow = 2, ncol = 2)
m3 <- matrix(c(9,10,11,12), nrow = 2, ncol = 2)
X <- matrix(c(1,2,3,4,5,6), nrow = 3, ncol = 2)
weighted_mean_multivariate(matrix = X,
                           weights = list(m1, m2, m3),
                           inverse_sum_weights = inverse_sum_matrices(list(m1, m2, m3)))

rchan26/hierarchicalFusion documentation built on Sept. 11, 2022, 10:30 p.m.