Learn R Programming

sclr (version 0.1.0)

sclr_fit: Fitter function for the scaled logit model

Description

Computing engine behind sclr.

Usage

sclr_fit(y, x, tol = 10^(-7), n_iter = NULL, max_tol_it = 10^4)

Arguments

y

A vector of observations.

x

A design matrix.

tol

Tolerance. Used when n_iter is NULL.

n_iter

Number of Newton-Raphson iterations. tol is ignored when this is not NULL.

max_tol_it

Maximum tolerated iterations. If it fails to converge within this number of iterations, will return with an error.

Details

The likelihood maximisation uses the Newton-Raphson algorithm. Initial values are always 1 for the covariate coefficients (and the associated intercept) and the proportion of infected for the baseline risk. The algorithm will pick a new guess and restart under a set of conditions. 1) Algorithm's iteration produces estimate guesses that cannot be used - baseline risk outside of (0, 1) (likelihood undefined). 2) The second derivative matrix produced by the current estimates is "bad" - positive diagonal or missing values due to failing large number calculations