Learn R Programming

mppa (version 1.0)

mkF: Estimation of the cumulative intensity of a process using native density

Description

A function that estimates the density of the points and then creates a valid cumulative intensity function F for input to corrtest.

Usage

mkF(x, start = 0, end = 1, adjust = 1, disallow.zero = TRUE)

Arguments

x
a vector of event times.
start
the start of the observation period: must be smaller than all elements of x.
end
the end of the observation period: must be greater than all elements of x.
adjust
parameter passed on to density.
disallow.zero
if TRUE do not allow F to be constant. (Useful to avoid spurious results when using corrtest.)

Value

A non-decreasing function that can serve as input to corrtest.

References

Patrick Rubin-Delanchy and Nicholas A Heard. ``A test for dependence between two point processes on the real line''. arXiv:1408.3845.

See Also

corrtest

Examples

Run this code
start=0; end=1
A=rbeta(100, 1, 10)
B=rbeta(100, 1, 10)
##This will be extreme because A and B are not homogeneous over [0,1]
corrtest(A,B)
##If we use an estimate of F the p-value is less aggressive
corrtest(A,B,F=mkF(c(A,B), start=0, end=1))
##But we can still find evidence of A causing B:
Bc=c(B, sample(A, 10)+abs(rnorm(10, 0,.0001))); Bc = Bc[Bc>start&Bc<end]
corrtest(A,Bc,F=mkF(c(A,Bc), start=0, end=1))

Run the code above in your browser using DataLab