setQLdata: Setup of quasi-likelihood data for estimation

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 obtained from simQLdata

X

list or matrix of (design) points, i.e. model parameters

var.type

name of variance matrix approximation type: "cholMean" (default)

Nb

number of bootstrap samples, =0 (default, no bootstrap used), to be generated for kriging the variance matrix, only if 'var.type'='kriging'

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 points 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 point unless 'var.type' equals "const" in which case a constant variance matrix approximation is expected to be given by the user in function qle. The Cholesky decompositions are used for an average approximation of the variance matrices of the statistics when calculating the quasi-score vector or any type of function criterion. If these fail for any reason we try to ignore, if possible, the corresponding sample points and exclude these from all subsequent computations. Unless a constant variance matrix estimate is used, the default is to approximate the variance matrix at any model parameter by either a kriging approximation of the Cholesky terms (kriging the variance matrix) or as an average over all sampled variance matrices (variance matrix average approximation) 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 simulation runs (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))

Lb

if applicable, bootstrap variances of covariances

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

The following items are stored as attributes:

type

see above

nsim

number of simulations spent at each (design) point

xdim

length of model parameter

nWarnings

Number of warnings during simulation runs

nErrors

Number of errors during simulation runs

nIgnored

List of parameters ignored due to errors

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) 
  

qle documentation built on May 2, 2019, 9:55 a.m.