HRR_sbsp_est: Subsampling Hazard Rate Ratio Point Estimations

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/HRR_sbsp_est.R

Description

This function returns point Estimations of probability density function and hazard rate ratio function.

Usage

1
2
HRR_sbsp_est(pt_int,cdf,kernel = "gaussian",hazard_bandwidth = NA,
             knn = NA, n_hz_sample, n_hz_size = length(cdf))

Arguments

pt_int

a vector of estimated points.

cdf

a sorted vector that needs to be estimated.

kernel

a character string giving the smoothing kernel to be used. This must partially match one of "gaussian", "rectangular", "triangular" or "knn", with default "gaussian".

hazard_bandwidth

the smoothing bandwidth to be used.

knn

number of neighbor points to be considered in smoothing for the "knn" kernel.

n_hz_sample

number of replicates.

n_hz_size

resampled size. Default to be same as length(cdf).

Details

A smaller n_hz_size can significantly cut down the running time while the accuracy is maintained by large n_hz_sample. It is similar as the "bagging" method in machine learning.

Value

This function returns a list with components:

fhat

A function performing the linear interpolation of smoothed probability density function of given data points.

HRR

A function performing the linear interpolation of smoothed hazard rate ratio point estimations.

Author(s)

Zhicong Zhao

See Also

HRR_pt_est for each replicate.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
temp <- HRR_sbsp_est(pt_int = seq(0,1,0.1),
                     cdf = sort(rbeta(5000,2,5)),
                     kernel = "triangular",
                     hazard_bandwidth = 0.1,
                     n_hz_sample = 30)
## plot ##
plot(temp$fhat,col = "blue",xlab = NA,ylab = NA)
points(seq(0,1,0.1),dbeta(seq(0,1,0.1),2,5),type = "l",col = "red")
legend("top",legend = c("estimated density","population density"),
       lty = 1, col = c("blue","red"))

zhicongz/AnomDetct documentation built on Dec. 12, 2019, 9:16 a.m.