Learn R Programming

qrcm (version 3.1)

test.fit.iqrL: 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 iqrL
test.fit(object, R = 100, trace = FALSE, ...)

Value

a vector with entries statistic and p.value, reporting the Kolmogorov-Smirnov statistic (evaluated on a grid) and the associated p-value.

Arguments

object

an object of class “iqrL”.

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.

Author

Paolo Frumento paolo.frumento@unipi.it

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).

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

Run this code
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
# \donttest{
test.fit(m1, R = 20)
test.fit(m2, R = 20)
# }
# Warning: this procedure may be time-consuming.

Run the code above in your browser using DataLab