lis {LIStest}R Documentation

Longest increasing subsequence for a univariate sample

Description

calculate the size of the longest increasing subsequence for a sample of a continuous random variable.

Usage

lis(x)

Arguments

x x is a numeric vector of data values

Value

Integer, the size of the longest increasing subsequence.

Author(s)

Jesus Garcia and Veronica Andrea Gonzalez Lopez

References

A nonparametric idependence test for small sample size

Examples

X<-rexp(50) 
Y<-runif(50,0,X)
res<-LIS.pvalue(X,-Y,alternative="two.sided")
res

## The function is currently defined as
function( x ){
        N<-length(x);
        gr<-c(1:N)*0
        gr[1]<-1
        for ( i in 2:N ){
                gr[i] = 1;
                for ( j in 1:(i - 1) ){ 
                        if ( x[i] > x[j] ) { gr[i] = max( gr[i], gr[j] + 1) } 
                }
        }
        rr<-max( gr )
  }

[Package LIStest version 1.0 Index]