RindexDual {MCARtest}R Documentation

A function computing the incompatibility index and associated closest joint mass function using the dual formulation

Description

A function solving a linear program to compute the incompatibility index R() defined in Berrett and Samworth (2023), in the case of having discrete random variables. Uses Amatrix to define to constraint matrix and lpSolve to implement the linear optimisation.

Usage

RindexDual(pS, bS, M, lp_solver = "default", simplex_strategy = 4)

Arguments

pS

A sequence of probability mass functions on the marginal spaces.

bS

A binary matrix specifying the set of observation patterns. Each row encodes a single pattern.

M

A vector of positive integers giving the alphabet sizes of the discrete variables.

lp_solver

An argument passed to HiGHS specifying which solver to use.

simplex_strategy

An argument passed to HiGHS specifying which solver to use.

Value

The value of R(), in the interval [0,1].

The optimal solution to the linear program

References

Berrett TB, Samworth RJ (2023). “Optimal nonparametric testing of Missing Completely At Random, and its connections to compatibility.” Ann. Statist., 51, 2170–2193.

Examples

bS=matrix(c(1,1,0, 1,0,1, 0,1,1),byrow=TRUE,ncol=3)
M=c(2,2,2)
A=Amatrix(bS,M)

pS=rep(0.25,12)
linprog=RindexDual(pS,bS,M)
rbind(pS,as.vector(A%*%linprog[[2]])/(1-linprog[[1]]))

pS=c(0.125,0.375,0.375,0.125,0.250,0.250,0.250,0.250,0.100,0.400,0.400,0.100)
linprog=RindexDual(pS,bS,M)
rbind(pS,as.vector(A%*%linprog[[2]])/(1-linprog[[1]]))


[Package MCARtest version 1.2.1 Index]