test.fit.iqrL {qrcm} | R Documentation |
Goodness-of-Fit Test
Description
Goodness-of-fit test for a model
fitted with iqrL
. The Kolmogorov-Smirnov statistic is computed and its
distribution under the null hypothesis is evaluated with Monte Carlo.
Usage
## S3 method for class 'iqrL'
test.fit(object, R = 100, trace = FALSE, ...)
Arguments
object |
an object of class “ |
R |
number of Monte Carlo replications. If R = 0, the function only returns the test statistic. |
trace |
logical. If TRUE, the progress will be printed. |
... |
for future arguments. |
Details
This function permits assessing goodness of fit by testing the null hypothesis
that the estimated (u,v)
values are independent uniform variables.
To evaluate the distribution of the test statistic under the true model, a Monte Carlo
method is used (Frumento et al, 2021).
Value
a vector with entries statistic
and p.value
,
reporting the Kolmogorov-Smirnov statistic (evaluated on a grid)
and the associated p-value.
Author(s)
Paolo Frumento paolo.frumento@unipi.it
References
Frumento, P., Bottai, M., and Fernandez-Val, I. (2021). Parametric modeling of quantile regression coefficient functions with longitudinal data. Journal of the American Statistical Association, 116 (534), 783-797.
Examples
id <- rep(1:50, each = 10)
y <- rnorm(500) + rnorm(50)[id]
m1 <- iqrL(fx = y ~ 1, fu = ~ I(qnorm(u)), id = id) # correct
m2 <- iqrL(fx = y ~ 1, fu = ~ u, id = id) # misspecified
test.fit(m1, R = 20)
test.fit(m2, R = 20)
# Warning: this procedure may be time-consuming.