View source: R/iqrL3_test_fit.R
test.fit.iqrL | R Documentation |
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.
## S3 method for class 'iqrL'
test.fit(object, R = 100, trace = FALSE, ...)
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. |
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).
a vector with entries statistic
and p.value
,
reporting the Kolmogorov-Smirnov statistic (evaluated on a grid)
and the associated p-value.
Paolo Frumento paolo.frumento@unipi.it
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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.