testfit.niqr {qrcmNP} | R Documentation |
Goodness-of-Fit Test
Description
Goodness-of-fit test for a model
fitted with niqr
. The Kolmogorov-Smirnov statistic and the Cramer-Von Mises statistic
are computed. Their distribution under the null hypothesis is estimated
with Monte Carlo (see ‘Details’).
Usage
testfit.niqr(obj, R = 100)
Arguments
obj |
an object of class “ |
R |
number of Monte Carlo replications. |
Details
This function permits assessing goodness of fit by testing the null hypothesis
that the CDF values follow a U(0,1)
distribution, indicating that
the model is correctly specified.
Since the CDF values depend on estimated parameters, the distribution of
the test statistic is not known. To evaluate it, the model is fitted on R simulated datasets
generated under the null hypothesis.
Value
a matrix with columns statistic
and p.value
,
reporting the Kolmogorov-Smirnov and Cramer-Von Mises statistic and the associated
p-values evaluated with Monte Carlo.
Author(s)
Gianluca Sottile gianluca.sottile@unipa.it
References
Frumento, P., and Bottai, M. (2015). Parametric modeling of quantile regression coefficient functions. Biometrics, doi: 10.1111/biom.12410.
Examples
n <- 300
x <- runif(n)
fun <- function(theta, p){
beta0 <- theta[1] + exp(theta[2]*p)
beta1 <- theta[3] + theta[4]*p
cbind(beta0, beta1)}
beta <- fun(c(1,1,1,1), runif(n))
y <- beta[, 1] + beta[, 2]*x
model <- niqr(fun=fun, x0=rep(0, 4), X=cbind(1,x), y=y)
## Not run: testfit.niqr(model, R=100)