View source: R/HelperFunctions.R
| unconstrained_fit_default | R Documentation |
Fits generalized linear models without smoothing constraints using penalized maximum likelihood estimation. This is applied to each partition to obtain the unconstrained estimates, prior to imposing the smoothing constraints.
Hot-start estimates are initialized by treating the matrix square-root inverse
as pseudo-observations, appending to the rows of the design matrix, and
calling glm.fit replacing the response for pseudo-observations
with the inverse link function applied to the value of eta = XB = 0. For log
link, exp(0) = 1 is valid for most families. For cases like inverse link,
dividing by 0 is obviously not possible, so this is replaced with 1/tol
where tol is the convergence tolerance argument.
unconstrained_fit_default(
X,
y,
LambdaHalf,
Lambda,
keep_weighted_Lambda,
family,
tol,
K,
parallel,
cl,
chunk_size,
num_chunks,
rem_chunks,
order_indices,
weights,
...
)
X |
Design matrix of predictors |
y |
Response variable vector |
LambdaHalf |
Square root of penalty matrix
( |
Lambda |
Penalty matrix ( |
keep_weighted_Lambda |
Logical flag to control penalty matrix handling:
- |
family |
Distribution family specification |
tol |
Convergence tolerance |
K |
Number of partitions minus one ( |
parallel |
Flag for parallel processing |
cl |
Cluster object for parallel computation |
chunk_size |
Processing chunk size |
num_chunks |
Number of computational chunks |
rem_chunks |
Remaining chunks |
order_indices |
Observation ordering indices |
weights |
Optional observation weights |
... |
Additional arguments passed to |
Numeric column vector of unconstrained coefficient estimates.
For fitting non-canonical GLMs, use keep_weighted_Lambda = TRUE
since the score and Hessian equations below are no longer valid.
For Gamma(link='log') using keep_weighted_Lambda = TRUE is
misleading. The information is weighted by a constant (shape parameter)
rather than some mean-variance relationship. So
keep_weighted_Lambda = TRUE is highly recommended for log-link Gamma
models. This constant flushes into the penalty terms, and so the
formulation of the information matrix is valid.
For other scenarios, like probit regression, there will be diagonal weights incorporated into the penalty matrix for providing initial MLE estimates, which technically imposes a prior distribution on beta coefficients that isn't by intent.
Heuristically, it shouldn't affect much, as these will be updated to their proper form when providing estimates under constraint; lgspline otherwise does use the correct form of score and information afterwards, regardless of canonical/non-canonical status, as long as 'glm_weight_function' and 'qp_score_function' are properly specified.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.