constants: Calculate constants across estimation

View source: R/utility.R

constantsR Documentation

Calculate constants across estimation

Description

constants calculates various values that do not change across the estimation and records them in a list.

Usage

constants(
  call,
  formula,
  data,
  reference = c("normal"),
  sign_level,
  estimator,
  split,
  shuffle,
  shuffle_seed,
  iter,
  criterion,
  max_iter,
  user_model,
  verbose
)

Arguments

call

A record of the original function call.

formula

The regression formula specified in the function call.

data

The dataframe used in the function call.

reference

A character vector of length 1 that denotes a valid reference distribution.

sign_level

A numeric value between 0 and 1 that determines the cutoff in the reference distribution against which observations are judged as outliers or not.

estimator

A character vector specifying which initial estimator was used.

split

A numeric value strictly between 0 and 1 that specifies how the sample is split in case of saturated 2SLS. NULL otherwise.

shuffle

A logical value whether the sample is re-arranged in random order before splitting the sample in case of saturated 2SLS. NULL otherwise.

shuffle_seed

A numeric value setting the seed for the shuffling of the sample. Only used if shuffle == TRUE. NULL otherwise.

iter

An integer value setting the number of iterations of the outlier-detection algorithm.

criterion

A numeric value that determines when the iterated outlier-detection algorithm stops by comparing it to the sum of squared differences between the m- and (m-1)-step parameter estimates. NULL if convergence criterion should not be used.

max_iter

A numeric value that determines after which iteration the algorithm stops in case it does not converge.

user_model

A model object of class ivreg. Only required if argument initial_est is set to "user", otherwise NULL.

verbose

A logical value whether progress during estimation should be reported.

Value

Returns a list that stores values that are constant across the estimation. It is used to fill parts of the "robust2sls" class object, which is returned by outlier_detection.

$call

The captured function call.

$verbose

The verbose argument (TRUE/FALSE).

$formula

The formula argument.

$data

The original data set.

$reference

The chosen reference distribution to classify outliers.

$sign_level

The significance level determining the cutoff.

$psi

The probability that an observation is not classified as an outlier under the null hypothesis of no outliers.

$cutoff

The cutoff used to classify outliers if their standardised residuals are larger than that value.

$bias_corr

A numeric bias correction factor to account for potential false positives (observations classified as outliers even though they are not).

$initial

A list storing settings about the initial estimator: $estimator is the type of the initial estimator (e.g. robustified or saturated), $split how the sample is split (NULL if argument not used), $shuffle whether the sample is shuffled before splitting (NULL if argument not used), $shuffle_seed the value of the random seed (NULL if argument not used), $user the user-specified initial model (NULL if not used).

$convergence

A list storing information about the convergence of the outlier-detection algorithm: $criterion is the user-specified convergence criterion (NULL if argument not used), $difference is initialised as NULL. $converged is initialised as NULL. $iter is initialised as NULL. $max_iter the maximum number of iterations if does not converge (NULL if not used or applicable).

$iterations

A list storing information about the iterations of the algorithm. $setting stores the user-specified iterations argument. $actual is initialised as NULL and will store the actual number of iterations done.


robust2sls documentation built on Jan. 11, 2023, 5:13 p.m.