This release adds constrained versions of the three
automatic-smoothness fitting functions. They search for the single-index
direction on a reparameterization that satisfies the identifiability
constraint (||beta|| = 1, beta_1 > 0) by
construction, rather than normalizing and sign-flipping the estimate
after the search.
New plsi.lr.auto.constraint(),
plsi.logistic.auto.constraint(), and
plsi.log.auto.constraint() fit the same models as
plsi.lr.auto(), plsi.logistic.auto(), and
plsi.log.auto() (continuous, binary, and count outcomes),
with the single-index direction parameterized as
beta(sigma) = (sqrt(1 - ||sigma||^2), sigma_1, ..., sigma_{p-1}).
Both identifiability constraints hold for any
||sigma|| < 1, so optim() searches over
sigma without post-hoc normalization. Standard errors for
beta are obtained from the numerical Hessian and mapped
back to beta by the delta method.
The anchor exposure (the coordinate constrained to be positive)
is the exposure with the largest absolute correlation with the
outcome, so an exposure strongly but negatively associated with the
outcome can serve as the anchor. The choice is reported in a new
anchor.note element and in
attr(si.coefficient, "note").
The returned lists include initial.sigma.table, the
starting values used in the sigma-space search, in addition
to the elements returned by the corresponding *.auto()
function.
plsi.logistic.auto.constraint() and
plsi.log.auto.constraint() also provide:
maxit argument controlling the number of Nelder-Mead
iterations per starting value (default 100).optim.convergence table reporting, for every
starting value, the optim() convergence code, the number of
likelihood evaluations, and the final log-likelihood. A warning is
issued if the selected start did not converge.|beta_j|, which keeps finite-difference steps
away from the ||sigma|| = 1 boundary when the anchor’s
estimated coefficient is small. Point estimates are unaffected.Standard-error safeguards in all three functions:
sigma values and failed gam()
fits are scored with a large finite penalty rather than
-Inf, so finite-difference Hessians remain numerically
defined.Input checks: at least two exposures are required; missing
columns and missing values raise informative errors.
plsi.logistic.auto.constraint() accepts a 0/1 outcome or a
two-level factor (coerced to 0/1 with a message reporting the mapping).
plsi.log.auto.constraint() requires non-negative integer
counts and supports family = "nb" (default) or
"poisson".
All three functions return objects compatible with the existing
plotting functions, using type = "linear",
"logistic", or "log" respectively.
This is a major release: the partial linear single index model family gains three fitting functions with automatic smoothness selection, and several correctness bugs in the original fitting and plotting functions are fixed.
plsi.lr.auto() is now the recommended starting point for
continuous outcomes. plsi.lr.v2() remains available when
you want manual control over the link function’s degrees of freedom (for
example, in simulation studies or when the appropriate basis complexity
is already known).
New plsi.lr.auto() fits the partial linear single
index model for a continuous outcome, selecting the smoothness of the
link function automatically via mgcv::gam() with REML. Only
an upper-bound basis dimension k is required;
spline.num no longer needs hand-tuning.
New plsi.logistic.auto() is the binary-outcome
analog of plsi.lr.auto(), using a binomial()
family GAM.
New plsi.log.auto() is the count-outcome analog of
plsi.lr.auto(), supporting Poisson and negative binomial
families with a log link. family = "nb" is the default and
is recommended for overdispersed counts.
All three *.auto() functions report Wald-based
standard errors, confidence intervals, and effect-size summaries for
both the single-index coefficients and the confounder coefficients (odds
ratios for plsi.logistic.auto(), rate ratios for
plsi.log.auto()).
plsi.lr.v2() gains a seed argument for
reproducible random initial values.
All plotting functions now take a type argument
("linear", "logistic", or "log")
matching the fitting function used: si.fun.plot(),
si.coef.plot(), e.main.plot(),
e.interaction.plot(),
interquartile.quartile.plot(), and
mixture.overall.plot().
plsi.lr.v1() is superseded by
plsi.lr.v2(), which includes all fixes listed below.
Existing code should switch to plsi.lr.v2() or, preferably,
plsi.lr.auto().plsi.lr.v1() crashed whenever more than one exposure
was supplied, due to a transposition error (t(beta_est)
inside cbind()). Fixed in
plsi.lr.v2().
plsi.lr.v2() no longer produces an invalid index
sequence when initial.random.num = 0. The
*.auto() functions validate this input and raise an
informative error.
plsi.lr.v2() now coerces logLik()
output with as.numeric().
Fixed typos in the element names returned by
plsi.lr.v2(): intial.table is now
initial.table, and all.intial.results is now
all.initial.results.
plsi.lr.v2()’s si.fun output used the
column name pred instead of fit, so
si.fun.plot(type = "linear") failed on
plsi.lr.v2() output. si.fun now consistently
uses fit, lwr, and upr.
e.interaction.plot() conditioned both panels on the
same exposure’s quantiles. Each panel now conditions on the other
exposure’s quantiles.
e.main.plot() referenced an undefined variable
(out_value).
Plotting functions no longer call ciTools::add_ci(),
which does not support mgcv::gam objects. Confidence bands
are now computed with predict.gam(se.fit = TRUE).
Standard errors for the single-index coefficients in
plsi.logistic.auto() and plsi.log.auto() no
longer collapse to near zero; the confounder-free prediction model is
now fit to the observed outcome with a fixed offset.
Standard errors for the single-index coefficients no longer
return NaN when the numerical information matrix is not
positive definite; eigenvalues are floored before inversion and a
warning is issued.
Corrected @importFrom declarations:
mgcv functions were listed under
@importFrom stats.
@return sections now use markdown-native syntax,
fixing corrupted Rd output in roxygen2 markdown mode.
stats, graphics, and utils
are now declared in Imports.
Added test files for plsi.lr.v2(),
plsi.lr.auto(), plsi.logistic.auto(),
plsi.log.auto(), and all six plotting functions.