weighted_mahal: weighted_mahal

Description Usage Arguments Value

View source: R/weighted_mahal.R

Description

Computes weighted Mahalanobis distance, using Choleski decomp.

Usage

1
2
3
4
5
6
7
8
weighted_mahal(
  x_mat,
  cov_x,
  weight_vec = NULL,
  treat_vec = NULL,
  sqrt_mahal = TRUE,
  partial_index = NULL
)

Arguments

x_mat

Numeric matrix (adjust non-numeric columns prior), already rank-adjusted if desired.

cov_x

Covariance of x, calculated potentially with ranks.

weight_vec

Vector of weights corresponding to columns of x_mat, giving weights relative to normal Mahalanobis.

treat_vec

optionally specify which units are treated.

sqrt_mahal

Logical, default TRUE; whether to use regular Mahalanobis.

partial_index

How to partition the full matrix.

Value

returns a matrix of pairwise distances; the relevant indexing depends on treat_vec and partial_index


rzgross/uRbanmatching documentation built on Dec. 22, 2021, 8:20 p.m.