Description Usage Arguments Details Value Author(s) References Examples
View source: R/iqr3_test_fit.R
Goodness-of-fit test for a model
fitted with iqr
. The Kolmogorov-Smirnov statistic and the Cramer-Von Mises statistic
are computed. Their distribution under the null hypothesis is evaluated
with Monte Carlo.
1 2 |
object |
an object of class “ |
R |
number of Monte Carlo replications. If R = 0, the function only returns the test statistics. |
zcmodel |
a numeric value indicating how to model the joint distribution of censoring (C) and truncation (Z). Only used when data are censored and truncated. See ‘Details’. |
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 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.
If the data are censored and truncated, object$CDF
is as well a censored and truncated outcome,
and its quantiles must be estimated with Kaplan-Meier. The fitted survival curve is then compared with
a U(0,1).
To run Monte Carlo simulations when data are censored or truncated,
the distribution of the censoring and that of the truncation variable must be estimated:
the function pchreg
from the pch package is used, with default settings.
The joint distribution of the censoring variable (C) and the truncation variable (Z) can be specified in two ways:
If zcmodel = 1 (the default), it is assumed that C = Z + U, where U is a positive variable and is independent of Z, given covariates. This is the most common situation, and is verified when censoring occurs at the end of the follow-up. Under this scenario, C and Z are correlated with P(C > Z) = 1.
If zcmodel = 2, it is assumed that C and Z are conditionally independent. This situation is more plausible when all censoring is due to drop-out.
The testing procedure is described in details by Frumento and Bottai (2016, 2017).
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.
Paolo Frumento paolo.frumento@unipi.it
Frumento, P., and Bottai, M. (2016). Parametric modeling of quantile regression coefficient functions. Biometrics, 72 (1), pp 74-84, doi: 10.1111/biom.12410.
Frumento, P., and Bottai, M. (2017). Parametric modeling of quantile regression coefficient functions with censored and truncated data. Biometrics, doi: 10.1111/biom.12675.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.