HMmdl(), MSARmdl(), MSARXmdl(),
MSVARmdl(), MSVARXmdl()) validate control$method up front: it must be
exactly "EM" or "MLE"; any other value (a misspelling, a lowercase
variant) errors by name instead of failing later with an unrelated message.stationarity_constraint (a margin delta; default 0 =
disabled, bit-identical to the previous behavior) on ARmdl(), ARXmdl(),
MSARmdl() and MSARXmdl(): the fitted autoregressive process satisfies
companion spectral radius <= 1 - delta. At p = 1 the constrained fit is
exact (a clip of the unconstrained solve with the remaining coefficients
re-solved exactly, under both least squares and the EM M-step); for
p >= 2 a root-scaling projection is used (a projection, not the
constrained optimizer: its likelihood shortfall relative to the constrained
optimum is typically a modest fraction of the constrained gap but can be
large on strongly nonstationary higher-order fits), accepted under EM only
when it does not lower the M-step objective, so the autoregressive step
never lowers the expected complete-data log-likelihood. Starting values
are projected into the margin region when the constraint is enabled.
Binding fits are flagged in phi_constraint_binding (NA when the
constraint could not be applied because the autoregressive block is
unidentified) and the autoregressive block's standard errors are set to
NA. For method = "MLE" the margin imposes the characteristic-root
bound whenever it is set. LMCLRTest()/MMCLRTest() warn when the two
model controls carry different margins. Intended for comparability with
procedures whose validity theory assumes stationarity (parametric bootstrap
tests); the Monte Carlo likelihood-ratio tests themselves do not require
it, and it does not interact with MMCLRTest()'s stationary_constraint
search control. When set on LMCLRTest()/MMCLRTest()'s
mdl_h0_control, the margin also carries into the one-regime fit used to
floor the null log-likelihood for k0 > 1, so every estimation feeding the
statistic follows the same rule on the observed and simulated sides alike.
Not implemented for the multivariate classes (loud error).MMCLRTest() aligns its nuisance search set with the estimation constraints
in mdl_h0_control by default (new control box_match_constraints = TRUE):
with a stationarity margin the search stays inside the margin region (the
autoregressive box is clamped at p = 1, and candidates whose companion
spectral radius exceeds 1 - delta are excluded for any p, counted in
margin_penalty_hits); with em_transition_constraint the transition-
probability box is clamped to the bounded simplex. The maximized test then
searches exactly the parameter space the constrained fits obey; FALSE
restores the unclamped box with a warning. No effect without an estimation
constraint. The transition-probability bound is aligned for EM nulls only;
a box_include point outside the margin errors as contradictory.mdl_h0_control sets stationarity_constraint and mdl_h1_control is
silent about it, the alternative inherits the same margin (with a warning),
as for msmu/msvar; an explicit different value still warns.ARmdl(), ARXmdl(), VARmdl(), VARXmdl())
now accept the Markov-switching estimation controls that the testing
functions forward to the null model regardless of its class
(use_diff_init, em_variance_constraint, em_transition_constraint) as
recognized-and-ignored names, removing the spurious "unknown names in
control" warning that fired once per simulated draw; unrecognized names
still warn.MMCLRTest() gains three additive controls for testing near the parameter
boundary of the null family. box_include guarantees supplied parameter
values (for example the unit root) are inside the nuisance-parameter search
box, as the two-sided convex hull of the ordinary interval and the value.
box_boundary ("union" or "face") builds the search box for a null of
two or more regimes, one possibly absorbing: regimes are relabeled
canonically (absorbing last), every candidate is simulated with the chain
initialized in canonical state 1 of the fitted null (the least persistent
transient regime; with more than one transient regime this fixed initial
state is part of the family's definition) with no burn-in, and the box
either stretches to cover the absorbing face ("union") or is the face
itself ("face", whose reference evaluation is reported as pval_proj). boundary_R sets the moment-anchored search ranges for the
parameters only the transient era identifies -- built per series for
multivariate models, with the transient covariances ranging over the
Cauchy-Schwarz bounds implied by the variance ranges; since a
per-coordinate box cannot express positive definiteness, the search runs
over the box intersected with the admissible parameter space (inadmissible
covariance candidates are excluded before simulation). Exogenous regressors
are supported throughout: their common coefficients are part of the
consistently identified block. Defaults leave all of this off, and the
default search is unchanged.aURfixLMCTest()
(LMC twice, second time simulating with the long-run autoregressive
coefficient at exactly 1), aBfixLMCTest() (LMC twice, second time at the
boundary projection with the absorbing regime's self-transition at exactly
1), aURdiffLMCTest() and aURdiffMMCTest() (levels and first-differenced
series with one fewer lag; exogenous regressors stay in levels for the
differenced component). The two components of a fix pair share the same
pre-drawn innovations and the same estimation-stream randomness, so they
differ only through the simulation parameter. With mc_seed set,
aURfixLMCTest()'s first component reproduces LMCLRTest() exactly;
aBfixLMCTest()'s first component is the LMC of the transient-start family
(canonical regime order, no burn-in), which coincides with LMCLRTest()
only when the fitted labels are already canonical.MMCLRTest() output gains search diagnostics: the realized box
(theta_low/theta_upp) and optim_diagnostics (exact evaluation count,
the range of candidates the optimizer evaluated, and the number of
candidates excluded by the positive-definiteness gate, for every optimizer
and independently of silence).CHPTest() is about 30x faster for the switching-variance alternative,
after moving the statistic and bootstrap into C++.hamilton84GNP and chp10GNP. The switching-mean-only alternative was
not affected.eps = 0 is now a valid search half-width for MMCLRTest() and
DLMMCTest(); GenSA nudges a zero entry to 1e-8 since it does not
accept a literal zero-width bound, unlike pso/GA.DLMMC_bounds() now falls back to eps per coefficient when its standard
error is non-finite, instead of discarding the confidence-interval
widening for every coefficient because of one, matching MMC_bounds().phi_low, phi_upp, P_low, P_upp, and variance_constraint are
validated before use; a non-finite value now errors by name.k0 >= 2.canonicalize_regimes() relabels a fitted model's regimes in ascending order
of persistence. New exported primitive; opt-in, never called automatically.mdl_h1_control does not name that flag, LMCLRTest() and MMCLRTest() now apply
the same restriction to the alternative, with a warning. The test then varies the
number of regimes alone; equality of means or variances can be tested separately.
Previously the alternative was estimated with switching means and variances while
its warm starts were built for the restricted model, so the warm starts were
discarded for the observed data but kept for every simulated draw, and the two
sides of the test were computed by different rules. Results change for that
configuration under every initialization method, since the alternative model itself
changes and not only its starting values. Stating the flag in mdl_h1_control
keeps the previous behaviour.HMmdl(), MSVARmdl() and MSVARXmdl() reported the regime means as a
transposed matrix when both the number of regimes and the number of series
exceeded one, which also affected intercept, beta, fitted, the simulated null
distribution of the Monte Carlo LR tests, and the warm starts built from a fitted
null. Means are now read from the parameter vector, which is the form the
estimation code and mdledit() already use. Parameter estimates and log
likelihoods are unchanged.
HMmdl() with a single series returned the variance in stdev. It now returns the
standard deviation, as documented and as the other model classes do.
MMCLRTest() no longer seeds the genetic algorithm with the fitted parameter
vector when that vector lies outside the search box, and validates the parameter
vector the optimizer returns before reporting a p-value for it. A search that
returns a non-finite vector, or a transition matrix whose columns do not sum to
one, is now an error rather than a reported result.The maximization step for the mean in HMmdl() is now the exact conditional
maximizer in every configuration. Two defects are fixed. When the mean does not
switch (msmu = FALSE), the update accumulated onto the previous iterate instead of
replacing it, so it converged to the sample mean inflated by a factor T/(T-1)
(one percent at T = 100); and it used an unweighted mean, whereas with
regime-specific covariances the maximizer is precision weighted,
mu = [sum_k w_k Sigma_k^-1]^-1 [sum_k Sigma_k^-1 sum_t xi_t(k) y_t]
(Krolzig 1997, Table 9.15). Separately, neither branch removed the contribution of
exogenous regressors before computing the mean, so HMmdl(Y, k, Z) lost likelihood
on every iteration in its default configuration. The mean now conditions on the
previous betaZ, matching the ordering used by MSARXmdl() and MSVARXmdl().
Estimates change for HMmdl() fits with msmu = FALSE or with exogenous
regressors; all other classes, the maximum-likelihood path, and HMmdl() with a
switching mean and no exogenous regressors are unchanged.
Two guards against malformed input reaching the maximization step directly: a
non-finite exogenous coefficient in a supplied init_theta no longer propagates
into the mean, and a per-regime covariance list shorter than the number of regimes
now raises an error instead of reading past the end of the list.
MMCLRTest() now simulates each candidate null distribution from the candidate's
own transition matrix. The internal routine that builds a simulation model from a
candidate parameter vector wrote the means, variances, autoregressive coefficients
and exogenous coefficients but never the transition matrix, so every candidate with
k0 > 1 was simulated from the fitted transition matrix instead. The limiting
probabilities of the simulation model are refreshed with it.MSVARXmdl() now returns the exogenous regressors in Z, as the other models with
exogenous regressors do. Their absence made the Monte Carlo tests unusable with a
Markov-switching vector autoregressive null with exogenous regressors.MMCLRTest(): the candidate model's variances are passed in the form the hidden
Markov simulator reads.MMCLRTest() now reports an informative error when the nuisance-parameter search
evaluates no admissible candidate, instead of returning the internal penalty value
as a p-value. This can happen when user-supplied search bounds exclude the null
model's own parameter values.print and summary methods for the class BootLRTest are removed. No
function in the package ever created an object of that class.argrid_MSARmdl, argrid_MSVARmdl, arP) are now computed in C++ inside the
estimation code instead of being fetched and called as R functions from C++ on
every likelihood evaluation and EM iteration. Results are bit-identical; typical
speedups are 10-20% for EM estimation and the Monte Carlo LR tests, and 1.6-2x
for univariate method = "MLE" fits. The R helpers remain exported and are the
reference implementations; C++ counterparts are available as
argrid_MSARmdl_cpp(), argrid_MSVARmdl_cpp(), and arP_cpp().library(MSTest) required,
and namespace-only usage such as MSTest::MSARmdl() or some parallel-worker
setups failed); lookups now resolve through the package namespace.em_transition_constraint (default 0 = off) for the five
Markov-switching model classes (HMmdl(), MSARmdl(), MSARXmdl(),
MSVARmdl(), MSVARXmdl()): bounds every transition probability below by the
given value during EM estimation (p_ij >= eps; because columns sum to 1 this is
equivalent to the two-sided bound eps <= p_ij <= 1-eps used by Kasahara and
Shimotsu (2018) and Qu and Zhuo (2021)). The constrained update is the exact
maximizer of the expected complete-data log-likelihood over the bounded simplex
(a closed-form water-filling solution), so the EM monotone-ascent property is
preserved (restricted EM in the sense of Kim and Taylor, 1995). Starting values
are projected into the bound. The default 0 (or a negative value) disables the
constraint and is bit-identical to the previous behavior. Must be less than
1/k; note the bound implies each diagonal entry is at most
1 - (k-1)*em_transition_constraint, so choose it with this cap in mind for
k > 2.em_transition_constraint (echoed) and
P_constraint_binding (k x k logical, TRUE where a fitted entry sits at the
bound). Entries at the bound are boundary estimates and their standard errors
are NA. Both apply to method = "EM" only; MLE fits return
P_constraint_binding = NULL (use mle_theta_low/mle_theta_upp to bound the
MLE path).init_theta is now validated: its transition-matrix block (the
last k*k entries, vec(P) column-major) must be finite, in [0,1], and
column-stochastic (columns summing to 1). Previously malformed starting values
were accepted and could be returned as invalid "fitted" transition matrices;
they now raise an informative error.method = "MLE" fit return its starting values: the
result guard tested res$status, but nloptr::slsqp() returns res$convergence
(positive codes are successes). MLE fits now return the optimized solution. All five
Markov-switching classes were affected (HMmdl(), MSARmdl(), MSARXmdl(),
MSVARmdl(), MSVARXmdl()).MSVARmdl_mle() now passes deprecatedBehavior = FALSE to nloptr::slsqp(), matching
the other classes; previously its inequality constraints were interpreted with the
reversed (deprecated) sign convention.1 - Mod(eigenvalue) >= 0); the previous form permitted moduli up to 2, admitting
explosive solutions. Non-finite eigenvalues map to a finite penalty so the optimizer's
finite-difference Jacobian stays defined.HMmdl() with exogenous regressors: the variance floor was applied to the betaZ
block of the parameter vector (pinning coefficients near zero) because the constraint
selector did not skip it; the selector now covers the full parameter layout.mle_variance_constraint is now relative in every class: the smallest covariance
eigenvalue is bounded below by mle_variance_constraint * tr(Sigma_lin)/q, where
Sigma_lin is the one-regime fit covariance — the same anchoring as
em_variance_constraint. Previously HMmdl(), MSVARmdl(), and MSVARXmdl() used an
absolute floor (default 1e-3); their defaults are now 0.01 on the relative scale.mle_theta_low/mle_theta_upp)
before optimization, with the transition-probability block projected onto the
column-sum-to-one simplex inside the box; infeasible random starts no longer error and
burn retry attempts.slsqp() run whose final iterate is finite, feasible, and better than the
starting value is now kept (with a warning) instead of discarded.converged (codes 1-4) and convergence_code (the nloptr
status); estimMdl() with converge_check no longer errors on MLE fits.HMmdl_mle(), MSARmdl_mle(), and MSVARmdl_mle() raise an informative
error when mdl_in$sigma is missing and a variance floor is requested.MSARmdl(), MSARXmdl(), MSVARmdl(), and
MSVARXmdl() now computes the smoothed transition counts from the extended
(regime-history) state, as required when the conditional density depends on lagged
regimes (Hamilton 1994, sec. 22.4, eq. 22.4.16; Krolzig 1997, eq. 6.14 and sec. 9.3.5).
Previously the counts were computed from marginal single-regime probabilities, a formula
that is valid for hidden Markov models (p = 0) but not for switching-mean AR models;
this could cause the EM iteration to reduce the likelihood and converge to points that
are not likelihood optima.St) returned by the same four model classes are now
the aggregate of the extended-state smoother over the date-t regime. Previously they were
computed by a separate marginal recursion subject to the same limitation.limP() now guarantees a valid probability vector: at boundary or rank-deficient
transition matrices the least-squares solve could return tiny negative entries, which
corrupted the filter and smoother downstream; such solutions are now clipped at zero and
renormalized. The guard is conditional, so results are bit-identical whenever the
solution was already nonnegative (all interior transition matrices).maxit iterations and the returned iterations
reports the true count (previously one additional iteration ran and the count was one
too low).em_best_iterate (default TRUE) for the five Markov-switching model
classes: the EM returns the iterate with the highest log-likelihood visited, with the
smoothed probabilities, residuals, and log-likelihood evaluated at that iterate (one
additional E-step). Set to FALSE for the previous behavior (return the final iterate,
whose reported log-likelihood and smoothed probabilities lag the parameters by one
E-step). The new output element descents counts likelihood decreases observed along
the EM path.maxit_converge control (maximum number of fresh starting values
attempted when an estimation attempt returns errors or non-finite values) is now 10
(was 500). The retry loop is silent and was never observed to need more than one
attempt in extensive testing; the old default allowed a pathological worst case of
hundreds of wasted estimations per start.MMCLRTest() nuisance-parameter search box now applies the CI_union rule per
parameter: each parameter's bounds are the union of its eps band and its plus/minus two
standard-error interval where the standard error is finite. Previously a single
non-finite standard error (for example a variance at the EM floor, whose standard error
is NA by design) discarded the standard-error information for every parameter,
shrinking the whole search box to the eps band.maxit_converge
attempts), the Markov-switching constructors now raise an informative error naming the
model class and the relevant controls; previously this crashed with an unrelated
low-level error (replacement has length zero) part-way through the multistart loop.converged flag of EM fits obtained through estimMdl() now reports convergence
under the criterion selected by the conv control, as the model constructors already
did; previously the dispatcher replaced it with the parameter-change test regardless of
the chosen criterion. MLE fits, which do not set the flag, keep the parameter-change
fallback.limP validity at boundary transition
matrices, and smoothed-probability consistency with the extended-state smoother.HMmdl() (p = 0) is unaffected: the marginal formulas are exact there and unchanged.
Fits with a common (non-switching) mean are numerically unaffected beyond floating-point
noise. Estimates for switching-mean fits change; attained log-likelihoods typically
increase (small decreases of order 1e-2 are possible on individual datasets because the
filter is initialized at the ergodic distribution implied by the transition matrix, whose
dependence on the transition probabilities the update does not account for).v0.1.9.9002
is this state (pre-simulation freeze plus the EM regime-variance floor); v0.1.9.9001 was
the freeze alone, before the variance floor.LMCLRTest() and MMCLRTest() produce different numerical results than
version 0.1.9 (p-values, critical values, and possibly the observed statistic, which can only
weakly increase). This is a consequence of the warm-start, LR >= 0, and common-random-numbers
changes described below. Everything else is unchanged bit-for-bit: model estimation
(ARmdl(), MSARmdl(), etc. with default controls), the simulation functions (simu*), and
the other testing procedures (DLMCTest(), DLMMCTest(), CHPTest(), HLRTest()) reproduce
0.1.9 exactly. The R Journal article results are reproduced exactly by CRAN version 0.1.9
(see the note in inst/examples/article.R). Setting init_method = "random" and crn = FALSE
recovers the legacy behavior of the LR tests.HMmdl(), MSARmdl(), MSARXmdl(), MSVARmdl(),
MSVARXmdl()) now constrain the regime variances during EM estimation, via the new control
em_variance_constraint (default 0.01): sigma_k^2 >= 0.01 * sigma_linear^2, where
sigma_linear^2 is the variance of the one-regime fit of the same data (for multivariate
models the bound applies to the smallest eigenvalue of each regime covariance). Setting the
control to 0 disables it and reproduces the previous unconstrained behaviour. The bound
follows Kasahara and Shimotsu (2018) (on the variance rather than the standard-deviation
scale) and is in the spirit of the constrained maximum likelihood formulation of Hathaway
(1985, 1986).em_variance_constraint, sigma_floor, and
sigma_floor_binding (per-regime logical). Standard errors of variances that end at the
bound are reported as NA, since they are boundary estimates.LMCLRTest() and MMCLRTest() (each sample's bound comes from its own linear fit), so the
Monte Carlo p-values remain exact: Monte Carlo validity holds for any statistic computed by
the same rule on both sides, and the constrained-likelihood ratio is such a statistic. NOTE:
transition probabilities remain unconstrained, so the tests continue to allow boundary values
of the transition matrix.LMCLRTest() and MMCLRTest() gain an init_method control (default "warmstart"). The
alternative (k1-regime) model is now also initialized at deterministic warm starts built by
embedding the fitted null model into the k1-regime parameter space (duplicating regimes with
a split transition column, so the embedded point attains exactly the null log-likelihood, then
applying a small antisymmetric perturbation; one start per way of distributing the extra
regimes). These compete with the existing use_diff_init random starts, and the identical
procedure is applied to the observed data and to every simulated draw, preserving the
exchangeability underlying the Monte Carlo p-value. See warmstart_theta() (new, exported).
The embedding follows the null-hypothesis geometry of Kasahara & Shimotsu (2018) and the
component-splitting initialization of the EM-test literature (Chen & Li 2009).HMmdl(), MSARmdl(), MSARXmdl(), MSVARmdl(), MSVARXmdl()) gain an
additive init_theta_extra control: a list of extra deterministic starting vectors that
compete with the random multi-start draws (unlike init_theta, which bypasses the multi-start
search). Default behavior is unchanged bit-for-bit.LMCLRTest() and MMCLRTest() no longer stop with
"LRT_0 is negative": the observed statistic is set to 0 with a warning (when the magnitude is
non-negligible), and simulated null statistics are treated identically inside LR_samp_dist()
(previously, negative simulated draws were silently redrawn). Applying the same rule on both
sides preserves exchangeability; the induced ties at 0 are handled by the randomized
tie-breaking rule of Dufour (2006) already implemented in MCpval() and can only make the
test conservative. This also removes a source of bias in simulation studies, where
discarded negative-statistic replications previously inflated empirical rejection rates.k0 > 1, the null log-likelihood is floored at the one-regime (linear) fit — a feasible
point of the null space — identically on the observed and simulated sides.MMCLRTest() gains a crn control (default TRUE): an identical estimation-RNG stream (EM
starting values; master and parallel-worker streams) is replayed at every candidate theta
evaluation, so that together with the pre-drawn innovations the MC p-value is a deterministic
function of theta during the search — implementing Dufour (2006, Prop. 4.2) with the
estimation randomness folded into the fixed disturbance vector u. This removes optimizer
objective noise (which is size-safe but costs power and can trigger threshold_stop
spuriously) and makes the search fully reproducible. The RNG state is saved and restored
around each evaluation, so the optimizer's own search randomness and the user's session RNG
are unaffected.pval_0
(additive output field); under crn = TRUE the reported pval satisfies pval >= pval_0 by
construction.mc_seed stream via sample.int() instead of being derived as mc_seed + 1, mc_seed + 2.
The arithmetic scheme made replication r's optimizer stream identical to replication (r+1)'s
data/estimation stream whenever an outer simulation study used consecutive mc_seed values —
correlating replications. Drawn seeds remove this systematic collision (a draw-then-reseed
construction keeps the observed-data estimation and the pre-drawn innovations bit-identical
to 0.1.9 for a given mc_seed; only optimizer/worker streams change). When mc_seed is
NULL, internal seeds are drawn from the ambient RNG state, so a script-level set.seed()
makes both sequential and parallel runs fully reproducible. In the sequential legacy
configuration (mc_seed = NULL, crn = FALSE, workers = 0) no internal seeding happens at
all, so a script-seeded legacy run reproduces version 0.1.9 bit-for-bit (verified on the
R Journal article's MMC example).MMCLRTest(), so its search trajectory does not depend on any seed; pso and GA consume the
optimizer seed.MMCLRTest(): when the p-value at the initial values already satisfies
pval_0 >= threshold_stop, the nuisance-parameter search is skipped entirely and
pval = pval_0 is returned (mmc_optimout carries an early-stop marker). Previously the
optimizer was always launched and stopped via its own threshold rule, wasting one evaluation
(GenSA) or a full first swarm (pso). With threshold_stop slightly above the significance
level, most true-null replications in a simulation study now cost no more than a Local MC run.MMCLRTest(): user-supplied mdl_h0_control/mdl_h1_control sublists are now merged with
their defaults instead of replacing them, fixing an "argument is of length zero" error when a
supplied sublist omitted getSE.LMCLRTest(): the p-value is computed before the null draws are sorted (sorting is now only
used for the reported critical values); numerically equivalent, clearer semantics.sigma element of the DGP list for the univariate simulators
(simuAR(), simuARX(), simuMSAR(), simuMSARX()) was documented as a standard
deviation; it is (and always was) a variance (per-regime variances for the
Markov-switching versions), consistent with the multivariate simulators and the estimation
output convention. Documentation only; no change to any computation.randSN() now uses arma::randn instead of a Box-Muller
transform (faster, and avoids a log(0) edge case). IMPORTANT: this changes the random numbers
drawn for a given set.seed(), so simulated series (the simu* functions) and Monte Carlo
p-values (LMCLRTest(), MMCLRTest(), DLMCTest(), DLMMCTest(), CHPTest()) differ
numerically from earlier versions. Test conclusions and validity are unaffected.MMCLRTest(): the observed likelihood ratio statistic is now held fixed across the
nuisance-parameter search, following Dufour (2006), instead of being recomputed at each candidate
value. This corrects the maximized Monte Carlo p-value (which could previously be slightly liberal).MMCLRTest(): pre-drawn simulation innovations are now held fixed across the optimization
(fixed-error Monte Carlo; Dufour 2006, Prop. 4.2).LMCLRTest() and MMCLRTest(): added an mc_seed control for fully reproducible Monte Carlo
p-values; the number of parallel workers is capped at N when more workers than replications are
requested.LMCLRTest() and MMCLRTest(): robust handling of failed simulated draws. Non-finite draws are
dropped before the p-value is computed. If the simulated null distribution cannot be built at all
(every draw fails even after the re-draw safety), the functions now stop with an informative message
(increase use_diff_init or inspect the fit) instead of returning an invalid value or crashing the
optimizer. In MMCLRTest(), a candidate parameter value whose null cannot be simulated is penalized
so the optimizer avoids it; the initial value (theta_0) is exempt so that the MMC p-value remains
at least as large as the LMC p-value.MMCLRTest(): the GA optimizer now uses popSize = 10 by default (GA's own default of 50 makes the
search perform 50 x maxit expensive evaluations); additional GA controls can be passed through
optim_control.MCpval(): the type argument now accepts both long and short spellings
("geq", "leq", "two-tailed"/"two-tail", "absolute"/"abs") and raises an informative error
for an unrecognized value (previously it silently returned a sentinel). The documentation now matches
the accepted values.DLMMCTest(): fixed the sign of the stationarity penalty so non-stationary candidate parameters
are correctly avoided by the optimizer (previously, in some cases the maximized p-value could be
returned as the raw penalty constant).DLMCTest() and DLMMCTest(): corrected the sample size used to simulate the null distribution
of the moment-based statistics. The simulated moments are now computed from samples of length
T - p, matching the number of AR(p) residuals used for the observed statistic and for the
p-value calibration in approxDistDL() (previously T). This restores the exact exchangeability
underlying the Monte Carlo p-value (Dufour & Luger 2017); the effect is negligible for large
samples and grows with p/T.print()/summary() for DLMMCTest objects now display the nuisance parameter value that
maximizes the Monte Carlo p-value (theta_max_min/theta_max_prod) alongside the moment
statistics, matching the output of DLMCTest (display only; the returned object is unchanged).conv control for the EM stopping criterion in HMmdl(), MSARmdl(), MSARXmdl(),
MSVARmdl(), and MSVARXmdl(), with options "loglik" (relative log-likelihood change; the new
default), "theta" (relative parameter change, the previous behavior), "both" (both, following
Krolzig 1997), and "loglik-A"/"both-A" (Aitken-accelerated log-likelihood; Böhning et al. 1994,
McLachlan and Krishnan 2008). A separate ltol control sets the log-likelihood tolerance
(default 1e-7); thtol (default 1e-6) remains the parameter tolerance. NOTE: the default change
from parameter-based stopping to "loglik" can change estimates slightly for a given set.seed();
set conv = "theta" to recover the previous behavior. Simulations show "loglik" matches the size
and power of "theta" while converging substantially faster. Each fitted model now also reports a
converged flag.solve() with fallback), Hamilton-filter underflow handling, degenerate-regime guards,
positive-definite covariance regularization, and stationarity checks. Several data sets that
previously triggered solve(): solution not found now estimate successfully.MSVARXmdl() to call MSVARXmdl_em() (not MSVARmdl_em()) in the single-initial-value EM
branch (used when use_diff_init = 1 with a user-supplied init_theta), so exogenous regressors
are handled correctly on that path.se_method = "louis" control for the Markov-switching model constructors (HMmdl(),
MSARmdl(), MSARXmdl(), MSVARmdl(), MSVARXmdl()), computing expected-complete-data
standard errors (Louis 1982); automatic fallback from the observed-information Hessian to Louis
when the Hessian is ill-conditioned.NA standard errors for k >= 2. Per-parameter step sizes are used in the numerical
Hessian to keep transition probabilities within [0, 1].use_diff_init >= 1 (and maxit_converge >= 1) with a clear error
instead of failing cryptically.testthat) and an introductory vignette.README.md file with usage of new methods.DESCRIPTION file for changed dependencies and new version.DESCRIPTION file for new version.NEWS.md file to track changes to the package.README.md file to describe the package.