chi_bar_square_weights: function for computing the chi-bar-square weights based on...

con_weights_bootR Documentation

function for computing the chi-bar-square weights based on Monte Carlo simulation.

Description

The null-distribution of the test statistics under inequality constraints takes the form of mixtures of F-distributions. This function computes these mixing weights (a.k.a chi-bar-square weights and level probabilities).

Usage

con_weights_boot(VCOV, Amat, meq, R = 1e5L, 
                 chunk_size = 5000L, convergence_crit = 1e-03, 
                 seed = NULL, verbose = FALSE, ...)

Arguments

VCOV

variance-covariance matrix of the data for which the weights are to be calculated.

Amat

constraints matrix R (or a vector in case of one constraint) and defines the left-hand side of the constraint R\theta \ge rhs, where each row represents one constraint. The number of columns needs to correspond to the number of parameters estimated (\theta). The rows should be linear independent, otherwise the function gives an error. For more information about constructing the matrix R and rhs see restriktor.

meq

integer (default = 0) treating the number of constraints rows as equality constraints instead of inequality constraints. For example, if meq = 2, this means that the first two rows of the constraints matrix R are treated as equality constraints.

R

integer; the maximum number of bootstrap draws for mix_weights_bootstrap_limit. The default value is set to 1e5. See details for more information.

chunk_size

integer; the chi-bar-square weights are computed for samples of size chunk_size = 5000L. This process is repeated iteratively until the weights converges (see convergenge_crit) or the maximum is reached, i.e., mix_weights_bootstrap_limit.

convergence_crit

the convergence criterion for the iterative process. The default is 1e-03. See details for more information.

seed

seed value.

verbose

logical; if TRUE, information is shown at each bootstrap draw.

...

additional parameters for the rtmvnorm function.

Details

## Iterative Weight Updating and Convergence Checking ## The function adds in each run chunks of 5000 samples (default) to compute the chi-bar-square weights. After each iteration, the function checks if the weights have converged. This is determined by the convergence_crit parameter.

Convergence is assessed by comparing the absolute difference between the current and previous iteration's weights against the convergence_crit. If the change in weights is smaller than the convergence criterion, it indicates that the weights have stabilized, suggesting convergence.

If the weights have not converged and the mix_weights_bootstrap_limit has not been reached, the function proceeds with adding another set of 5000 samples and updates the weights accordingly.If the maximum number of iterations is reached without convergence, the function returns the (non-converged) weights. In this situation, it is advisible to increase the number of mix_weights_bootstrap_limit.

Value

If convergence is reached, the function returns a vector with the mixing weights with the following attributes:

total_bootstrap_draws

total number of bootstrap draws

converged

have the chi-bar-square weights converged

convergence_crit

convergence criterium

wt_bar_chunk

matrix with the chi-bar-square weights for each iteration

chunk_size

how many samples are added in each iteration

total_chunks

what is the maximum number of chunks based on mix_weights_bootstrap_limit and chunk_size

chunk_iter

number of iterations run

error.idx

which bootstrap samples were not succesful

mix_weights_bootstrap_limit

the maximum number of bootstrap draws

Author(s)

Leonard Vanbrabant and Yves Rosseel

References

Silvapulle, M.J. and Sen, P.K. (2005, p.79). Constrained Statistical Inference. Wiley, New York.

Examples

W <- matrix(c(1,0.5,0.5,1),2,2)
Amat <- rbind(c(0,1))
meq <- 0L
wt.bar <- con_weights_boot(W, Amat, meq, R = 99999)
wt.bar

# in practice you want to use are more conservative convergence criterion
wt.bar2 <- con_weights_boot(W, Amat, meq, R = 99999, convergence_crit = 1e-02)
wt.bar2

LeonardV/restriktor documentation built on April 23, 2024, 2:27 a.m.