check_G_mat: Check the contraints of KMC

View source: R/RcppExport.R

check_G_matR Documentation

Check the contraints of KMC

Description

To derive the empirical likelihood with constraints, we need to make sure there are solutions. Dines' method is used here to check whether the linear constraintsare proper or not.

Usage

check_G_mat(gmat)

Arguments

gmat

A p by n. Here p is the number of constraints, n is the number of observations. The matrix is defined in <doi: 10.1201/b18598>.

Value

flg

A flag: - 0: not proper - 1: proper

Author(s)

Yifan Yang(yfyang.86@hotmail.com)

References

Dines, L. L. (1926). On positive solutions of a system of linear equations Annals of Mathematics pages 386–392

Zhou, M. and Yang, Y. (2015). A recursive formula for the Kaplan-Meier estimator with mean constraints and its application to empirical likelihood Computational Statistics. Online ISSN 1613-9658.

Examples

#### A Proper Example ####
x <- c( 1, 1.5, 2, 3, 4.2, 5.0, 6.1, 5.3, 4.5, 0.9, 2.1, 4.3) 
d <- c( 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1) 
f1 <-function(x) { x - 3.7} 
f2 <- function(x) {x^2 - 16.5 } 
g <- list(f1, f2)
re = kmc.clean(x, d)
p = length(g)
n = length(re$kmc.time)
gmat<-matrix(0, p, n);
for(i in 1:p){
  gmat[i,] = g[[i]](re$kmc.time)
  }
# You may want to require(Rcpp) on some platforms (such Mac OSX-ARM)
# library(Rcpp)
# check_G_mat(gmat)

yfyang86/kmc documentation built on Nov. 29, 2022, 1:27 p.m.