qleTest: Monte Carlo testing

Description Usage Arguments Details Value Author(s)

View source: R/qleTest.R View source: R/qleTest.R


Monte Carlo hypothesis testing


qleTest(est, local = NULL, sim, ..., nsim = 100, obs = NULL,
  check.root = FALSE, alpha = 0.05, na.rm = TRUE, cl = NULL,
  iseed = NULL, verbose = FALSE)



object of class qle, the estimation results from function qle


optional, object of class QSResult, NULL (default), local estimation results


user supplied simulation function (see qle)


arguments passed to the simulation function 'sim'


number of model replications to generate the simulated statistics


optional, NULL (default), simulated statistics at the hypothesized parameter


logical, FALSE (default), whether to check consistency of estimated parameter (see checkMultRoot)


significance level for testing the hypothesis


logical, TRUE (default), whether to remove 'NA' values from the matrix of re-estimated parameters


cluster object, NULL (default), of class "MPIcluster", "SOCKcluster", "cluster"


integer, the seed for initializing the cluster workers for parallel computations


logical, TRUE for intermediate output


The function tests the null hypothesis H_0:\,\hat{θ}=θ_0, that is, whether the statistical model w.r.t. to the estimated parameter is true, against the alternative H_1:\,\hat{θ}\neqθ_0 by testing based on a Monte Carlo approach (see vignette). Due to the approximate nature of the assumed statistical model for the observed data the exact distribution of the test statistics, that is, the Mahalanobis distance or quasi-deviance, is generally unknown and therefore its asymptotic distribution might be an unrealistic assumption for the null hypothesis. For this reason, and in order to retrieve an empirical P-value for testing, we generate (pseudo-)observations from the outcome of the model replications and re-estimate the model parameter for each realization in the same way as done before when estimating the model parameter. This includes all possible types of variance approximations (by kriging or average approximation) and types of prediction variance (kriging or the CV-based variance).

The function expects an estimation result as returned from qle. If any generated observations are readily available at the final parameter estimate, then these can be passed by 'obs'. Otherwise the function first generates those using 'nsim' model replications at the estimated parameter as part of 'est' or 'local'. The criterion function approximations are used as it (specified in the object 'qsd') and will not be further improved by additional samples during the test. The value of the test statistic is either chosen as the current criterion function value in 'OPT' (see argument 'criterion' in getQLmodel) or is taken from the optional argument 'local'. Given the local results 'local' of class QSResult, the user can also select a different criterion function as a test statistic than before when estimating the parameter itself. Apart from the quasi-deviance as a test statistic, in principle, any supported type of a least squares criterion, more generally, the Mahalanobis distance, can be used depending on the prefered type of variance matrix approximation, see covarTx. Practically, the re-estimations might fail to converge, however, then the user can control the convergence conditions of the local solvers (including quasi-scoring) by the corresponding control parameters (see searchMinimizer). Any failed re-estimations are excluded from the test results and stored in the attribute 'info'. In addition, as part of the returned data frame 'param' the empirical standard error, predicted standard error (based on the average inverse quasi-information matrix), the root mean square error, the bias and sample mean value of the re-estimated parameters are also available.

For an example please see the package vignette.


An object of class qleTest as a list of:


data frame of estimated parameters and error measures


the test result


name of the test

and attributes:


mean square error matrix of re-estimated parameters


average inverse quasi-information matrix over all re-estimated parameters


inverse quasi-information matrix at the parameter to be tested 'est$par'


relative difference of the empirial and predicted standard error of the parameter to be tested


list of simulated observed statistics


results from re-estimating the model parameters for each simulated observation from 'obs'


average quasi-score, respectively, average gradient of the MD at the re-estimated parameters


always equal to "qle"


results of the numerical consistency checks for each re-estimated parameter


list of indices of re-estimation results where the inversion of the quasi-information matrix failed, the re-estimated parameters have NA values, criterion function minimizations have errors or did not converge numerically, the integer seed value 'iseed'


M. Baaske

mbaaske/qle documentation built on Feb. 3, 2018, 11:02 a.m.