nc_score_test | R Documentation |
This function computes the score test with the piecewise generalized Pareto distribution under the null hypothesis that the generalized Pareto with a single shape parameter is an adequate simplification. The score test statistic is calculated using the observed information matrix; both hessian and score vector are obtained through numerical differentiation.
nc_score_test(
time,
time2 = NULL,
event = NULL,
thresh = 0,
ltrunc = NULL,
rtrunc = NULL,
type = c("right", "left", "interval", "interval2"),
weights = rep(1, length(time))
)
time |
excess time of the event of follow-up time, depending on the value of event |
time2 |
ending excess time of the interval for interval censored data only. |
event |
status indicator, normally 0=alive, 1=dead. Other choices are |
thresh |
a vector of thresholds |
ltrunc |
lower truncation limit, default to |
rtrunc |
upper truncation limit, default to |
type |
character string specifying the type of censoring. Possible values are " |
weights |
weights for observations |
The score test is much faster and perhaps less fragile than the likelihood ratio test: fitting the piece-wise generalized Pareto model is difficult due to the large number of parameters and multimodal likelihood surface.
The reference distribution is chi-square
the value of a call to nc_test
set.seed(1234)
n <- 100L
x <- samp_elife(n = n,
scale = 2,
shape = -0.2,
lower = low <- runif(n),
upper = upp <- runif(n, min = 3, max = 20),
type2 = "ltrt",
family = "gp")
test <- nc_test(
time = x,
ltrunc = low,
rtrunc = upp,
thresh = quantile(x, seq(0, 0.5, by = 0.1)))
print(test)
plot(test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.