# NOT RUN {
# Compute the complementary cdf of D_{n}
# when the underlying distribution is a mixed distribution
# with two jumps at 0 and log(2.5),
# as in Example 3.1 of Dimitrova, Kaishev, Tan (2020)
## Defining the mixed distribution
Mixed_cdf_example <- function(x)
{
result <- 0
if (x < 0){
result <- 0
}
else if (x == 0){
result <- 0.5
}
else if (x < log(2.5)){
result <- 1 - 0.5 * exp(-x)
}
else{
result <- 1
}
return (result)
}
KSgeneral::mixed_ks_c_cdf(0.1, 25, c(0, log(2.5)), Mixed_cdf_example)
# }
# NOT RUN {
## Compute P(D_{n} >= q) for n = 5,
## q = 1/5000, 2/5000, ..., 5000/5000
## when the underlying distribution is a mixed distribution
## with four jumps at 0, 0.2, 0.8, 1.0,
## as in Example 2.8 of Dimitrova, Kaishev, Tan (2020)
n <- 5
q <- 1:5000/5000
Mixed_cdf_example <- function(x)
{
result <- 0
if (x < 0){
result <- 0
}
else if (x == 0){
result <- 0.2
}
else if (x < 0.2){
result <- 0.2 + x
}
else if (x < 0.8){
result <- 0.5
}
else if (x < 1){
result <- x - 0.1
}
else{
result <- 1
}
return (result)
}
plot(q, sapply(q, function(x) KSgeneral::mixed_ks_c_cdf(x, n,
c(0, 0.2, 0.8, 1.0), Mixed_cdf_example)), type='l')
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab