PM.matrix: Partial Moment Matrix

View source: R/RcppExports.R

PM.matrixR Documentation

Partial Moment Matrix

Description

This function generates a co-partial moment matrix for the specified co-partial moment.

Usage

PM.matrix(LPM_degree, UPM_degree, target, variable, pop_adj)

Arguments

LPM_degree

integer; Degree for variable below target deviations. (LPM_degree = 0) is frequency, (LPM_degree = 1) is area.

UPM_degree

integer; Degree for variable above target deviations. (UPM_degree = 0) is frequency, (UPM_degree = 1) is area.

target

numeric; Typically the mean of Variable X for classical statistics equivalences, but does not have to be. (Vectorized) (target = NULL) (default) will set the target as the mean of every variable.

variable

a numeric matrix or data.frame.

pop_adj

logical; TRUE Adjusts the sample co-partial moment matrices for population statistics. Use FALSE for degree 0 frequency matrices. Must be provided by user.

Value

Matrix of partial moment quadrant values (CUPM, DUPM, DLPM, CLPM), and overall covariance matrix. Uncalled quadrants will return a matrix of zeros.

Note

For divergent asymmetical "D.LPM" and "D.UPM" matrices, matrix is D.LPM(column,row,...).

Author(s)

Fred Viole, OVVO Financial Systems

References

Viole, F. and Nawrocki, D. (2013) "Nonlinear Nonparametric Statistics: Using Partial Moments" https://www.amazon.com/dp/1490523995/ref=cm_sw_su_dp

Viole, F. (2017) "Bayes' Theorem From Partial Moments" https://www.ssrn.com/abstract=3457377

Examples

set.seed(123)
x <- rnorm(100) ; y <- rnorm(100) ; z <- rnorm(100)
A <- cbind(x,y,z)
PM.matrix(LPM_degree = 1, UPM_degree = 1, variable = A, target = colMeans(A), pop_adj = TRUE)

## Use of vectorized numeric targets (target_x, target_y, target_z)
PM.matrix(LPM_degree = 1, UPM_degree = 1, target = c(0, 0.15, .25), variable = A, pop_adj = TRUE)

## Calling Individual Partial Moment Quadrants
cov.mtx <- PM.matrix(LPM_degree = 1, UPM_degree = 1, variable = A, target = colMeans(A), 
                     pop_adj = TRUE)
cov.mtx$cupm

## Full covariance matrix
cov.mtx$cov.matrix

OVVO-Financial/NNS documentation built on April 22, 2024, 10:26 p.m.