Learn R Programming

NNS (version 11.6.2)

PM.matrix: Partial Moment Matrix

Description

Builds a list containing CUPM, DUPM, DLPM, CLPM and the overall covariance matrix.

Usage

PM.matrix(LPM_degree, UPM_degree, target, variable, pop_adj, norm = FALSE)

Value

A list: $cupm, $dupm, $dlpm, $clpm, $cov.matrix.

Arguments

LPM_degree

numeric; lower partial moment degree (0 = freq, 1 = area).

UPM_degree

numeric; upper partial moment degree (0 = freq, 1 = area).

target

numeric vector; thresholds for each column (defaults to colMeans).

variable

numeric matrix or data.frame.

pop_adj

logical; TRUE adjusts population vs. sample moments.

norm

logical; default FALSE. If TRUE, each quadrant matrix is cell-wise normalized so their sum is 1 at each (i,j).

Details

Partial Moment Matrix

Examples

Run this code
set.seed(123)
A <- cbind(rnorm(100), rnorm(100), rnorm(100))
PM.matrix(1, 1, NULL, A, TRUE)          # uses norm = FALSE by default
PM.matrix(1, 1, NULL, A, TRUE, TRUE)    # enable normalization

Run the code above in your browser using DataLab