test.fit.niqr: Goodness-of-Fit Test

Description Usage Arguments Details Value Author(s) References Examples

View source: R/qrcmNL.R

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

1
test.fit.niqr(obj, R = 100)

Arguments

obj

an object of class “niqr”.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
n <- 1000
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)

#test.fit.niqr(model, R=100)

gianluca-sottile/qrcmNL documentation built on May 6, 2019, 6:01 p.m.