| fit_control {capybara} | R Documentation |
Set feglm Control Parameters
Description
Set and change parameters used for fitting feglm, felm, and fenegbin. Termination conditions are similar to glm.
Usage
fit_control(
dev_tol = 1e-08,
center_tol = 1e-06,
center_tol_loose = 1e-04,
collin_tol = 1e-10,
step_halving_factor = 0.5,
alpha_tol = 1e-08,
iter_max = 25L,
iter_center_max = 10000L,
iter_inner_max = 50L,
iter_alpha_max = 10000L,
step_halving_memory = 0.9,
max_step_halving = 2L,
start_inner_tol = 1e-06,
grand_acc_period = 4L,
centering = "berge",
sep_tol = 1e-08,
sep_zero_tol = 1e-12,
sep_max_iter = 200L,
sep_simplex_max_iter = 2000L,
sep_use_relu = TRUE,
sep_use_simplex = TRUE,
return_fe = TRUE,
keep_tx = FALSE,
check_separation = TRUE,
init_theta = 0,
vcov_type = NULL
)
Arguments
dev_tol |
tolerance level for the first stopping condition of the maximization routine. The stopping condition
is based on the relative change of the deviance in iteration r and can be expressed as follows: |dev_{r}
- dev_{r - 1}| / (0.1 + |dev_{r}|) < tol. The default is 1.0e-08.
|
center_tol |
tolerance level for the stopping condition of the centering algorithm. The stopping condition is
based on the relative change of the centered variable similar to the 'lfe' package. The default is
1.0e-06.
|
center_tol_loose |
initial (loose) tolerance for adaptive centering in GLM iterations. During early IRLS
iterations when deviance is changing rapidly, this looser tolerance is used to save computation. As the GLM
converges, the tolerance is tightened towards center_tol. The default is 1.0e-04.
|
collin_tol |
tolerance level for detecting collinearity. The default is 1.0e-07.
|
step_halving_factor |
numeric indicating the factor by which the step size is halved to iterate towards
convergence. This is used to control the step size during optimization. The default is 0.5.
|
alpha_tol |
tolerance for fixed effects (alpha) convergence. The default is 1.0e-06.
|
iter_max |
integer indicating the maximum number of iterations in the maximization routine. The default is
25L.
|
iter_center_max |
integer indicating the maximum number of iterations in the centering algorithm. The default is
10000L.
|
iter_inner_max |
integer indicating the maximum number of iterations in the inner loop of the centering
algorithm. The default is 50L.
|
iter_alpha_max |
maximum iterations for fixed effects computation. The default is 10000L.
|
step_halving_memory |
numeric memory factor for step-halving algorithm. Controls how much of the previous
iteration is retained. The default is 0.9.
|
max_step_halving |
maximum number of post-convergence step-halving attempts. The default is 2.
|
start_inner_tol |
starting tolerance for inner solver iterations. The default is 1.0e-04.
|
grand_acc_period |
integer indicating the period (in iterations) for grand acceleration in the centering
algorithm. Grand acceleration applies a second-level Irons-Tuck extrapolation on the overall convergence
trajectory. Lower values (e.g., 4-10) may speed up convergence for difficult problems. Set to a very large
value (e.g., 10000) to effectively disable. The default is 4L.
|
centering |
character string indicating the centering algorithm to use for demeaning fixed effects.
"stammann" (default) uses alternating projections with Gauss-Seidel sweeps plus Irons-Tuck and grand
acceleration on coefficient vectors. Each iteration updates each fixed-effect dimension in sequence.
"berge" uses a fixed-point reformulation as described in Berge (2018): all FE updates are composed
into a single map F = f_T \circ f_I, reducing the problem to finding \beta^* = F(\beta^*). The
Irons and Tuck (1969) acceleration is then applied to the composed iteration. Both methods use warm-starting
and grand acceleration.
|
sep_tol |
tolerance for separation detection. The default is 1.0e-08.
|
sep_zero_tol |
tolerance for treating values as zero in separation detection. The default is 1.0e-12.
|
sep_max_iter |
maximum iterations for ReLU separation detection algorithm. The default is 200L.
|
sep_simplex_max_iter |
maximum iterations for simplex separation detection algorithm. The default is 2000L.
|
sep_use_relu |
logical indicating whether to use the ReLU algorithm for separation detection. The default is TRUE.
|
sep_use_simplex |
logical indicating whether to use the simplex algorithm for separation detection. The default is TRUE.
|
return_fe |
logical indicating if the fixed effects should be returned. This can be useful when fitting general
equilibrium models where skipping the fixed effects for intermediate steps speeds up computation. The default is
TRUE and only applies to the feglm class.
|
keep_tx |
logical indicating if the centered regressor matrix should be stored. The centered regressor matrix is
required for some covariance estimators, bias corrections, and average partial effects. This option saves
some computation time at the cost of memory. The default is TRUE.
|
check_separation |
logical indicating whether to perform separation detection for Poisson models. When TRUE
(default), observations with perfect prediction are automatically detected and excluded from estimation. Set to
FALSE to skip this check and speed up computation when separation is known not to be an issue. The default
is TRUE.
|
init_theta |
Initial value for the negative binomial dispersion parameter (theta). The default is 0.0.
|
vcov_type |
Optional character string specifying the type of variance-covariance estimator to be used. It only
applies for formulas with a cluster variable like z ~ x + y | fe | cl. When NULL (default), the variance
covariance matrix follows a regular sandwich estimator. When set to "m-estimator", uses standard clustered
M-estimator sandwich. When set to "m-estimator-dyadic", uses dyadic clustering that accounts for correlation
between observations sharing entities. For dyadic clustering, specify two entity columns in the formula like
z ~ x + y | fe | cl1 + cl2.
|
Value
A named list of control parameters.
See Also
feglm, felm, and fenegbin
Examples
fit_control(0.05, 0.05, 10L, 10L, TRUE, TRUE, TRUE)