setQLdata: Set quasi-likelihood (QL) data

Description Usage Arguments Details Value Author(s) Examples

View source: R/simQLData.R

Description

Aggregate the data for quasi-likelihood estimation

Usage

1
2
setQLdata(runs, X = NULL, var.type = "cholMean", Nb = 0, na.rm = TRUE,
  verbose = FALSE)

Arguments

runs

list or matrix of simulation results from simQLdata

X

list or matrix of model parameters

var.type

character, "cholMean" (default), whether to Cholesky decompose variance matrices either for sample average variance approximation or kriging variance matrices

Nb

numeric, number of bootstrap samples for kriging the variance matrix, only if 'var.type'='kriging', default is zero which uses no bootstrapping

na.rm

if TRUE (default), remove 'NA' values from simulation results

verbose

if TRUE, print intermediate output

Details

The function aggregates all neccessary data for quasi-likelihood estimation storing the sample locations and the corresponding simulation results of the statistics. If 'X' equals NULL, then the sample points are taken from the object 'runs'.

The most critical part is the decomposition of variance matrices for each sample location unless 'var.type' equals "const" in which case a constant variance matrix approximation is expected later by function qle. The Cholesky decompositions are used for average approximations of the variance matrix of the statistics when calculating the quasi-score vector or any type of function criterion based on the Mahalanobis distance or quasi-deviance. If these fail for any reason we try to ignore, if possible, the corresponding sample points and exclude them from all following calculations. Unless a constant estimate of the variance matrix, the default is to approximate the variance at any model parameter by either a kriging interpolation of the Cholesky terms or as an average over all sampled variance matrices also based on the decomposed Cholesky terms (see vignette).

Value

An object of class QLdata as a data frame with columns:

X

Model parameters (n=1,...,q)

mean

Results of simulations (m=1,...,p)

var

Simulation variances of statistics (m=1,...,p)

L

if applicable, Cholesky decomposed terms of variance matrices of statistics (k=1,...,(m*(m+1)/2))

where 'p' denotes the number of user defined statistics and 'q' the problem dimension, that is, the number of parameters to be estimated.

The following items are stored as attributes:

type

see above

nsim

number of simulations at each point

xdim

parameter dimension

nWarnings

Number of warnings during simulations

nErrors

Number of errors during simulations

nIgnored

List of parameters ignored (because of failures)

Author(s)

M. Baaske

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# simulate model statistics at LHS design
sim <- simQLdata(sim =
         function(x,cond) {
           X <- rlnorm(cond$n,x[1],x[2])
           c("MED"=median(X),"MAD"=mad(X))
         },
         cond=list("n"=10),
         nsim=10, N=10, method="maximinLHS",
         lb=c("mu"=-1.5,"sd"=0), ub=c("mu"=2,"sd"=1))

# setup the QL data model using defaults
qldata <- setQLdata(sim,verbose=TRUE) 
  

mbaaske/qle documentation built on May 27, 2019, midnight