Used to fit the scaled logit model from Dunning (2006).

sclr(
  formula,
  data = NULL,
  ci_lvl = 0.95,
  tol = 10^(-7),
  algorithm = c("newton-raphson", "gradient-ascent"),
  nr_iter = 2000,
  ga_iter = 2000,
  n_conv = 3,
  conventional_names = FALSE,
  seed = NULL
)

Arguments

formula

an object of class "formula": a symbolic description of the model to be fitted.

data

a data frame.

ci_lvl

Confidence interval level for the parameter estimates.

tol

Tolerance.

algorithm

Algorithms to run. "newton-raphson" or "gradient-ascent". If a character vector, the algorithms will be applied in the order they are present in the vector.

nr_iter

Maximum allowed iterations for Newton-Raphson.

ga_iter

Maximum allowed iterations for gradient ascent.

n_conv

Number of times the algorithm has to converge (to work around local maxima).

conventional_names

If TRUE, estimated parameter names will be (Baseline), (Intercept) and the column names in the model matrix. Otherwise - lambda, beta_0 and beta_ prefix in front of column names in the model matrix.

seed

Seed for the algorithms.

Value

An object of class sclr. This is a list with the following elements:

parameters

Maximum likelihood estimates of the parameter values.

covariance_mat

The variance-covariance matrix of the parameter estimates.

algorithm

Algorithm used.

algorithm_return

Everything the algorithm returned.

n_converge

The number of Newton-Raphson iterations (including resets) that were required for convergence.

x

Model matrix derived from formula and data.

y

Response matrix derived from formula and data.

call

The original call to sclr.

model

Model frame object derived from formula and data.

terms

Terms object derived from model frame.

ci

Confidence intervals of the parameter estimates.

log_likelihood

Value of log-likelihood calculated at the ML estimates of parameters.

formula

Passed formula.

data

Passed data.

Methods supported: print, vcov, coef, model.frame, model.matrix, summary, predict, tidy (broom package), logLik.

Details

The model is logistic regression with an added parameter for the top asymptote. That parameter is reported as theta (or (Baseline) if conventional_names = TRUE). Note that it is reported on the logit scale. See vignette("sclr-math") for model specification, log-likelihood, scores and second derivatives. The main default optimisation algorithm is Newton-Raphson. Gradient ascent is used as a fallback by default. Computing engine behind the fitting is sclr_fit.

References

Dunning AJ (2006). "A model for immunological correlates of protection." Statistics in Medicine, 25(9), 1485-1497. https://doi.org/10.1002/sim.2282.

Examples

library(sclr) fit1 <- sclr(status ~ logHI, one_titre_data) summary(fit1)
#> Call: status ~ logHI #> #> Parameter estimates #> theta beta_0 beta_logHI #> -0.03497876 -5.42535734 2.14877741 #> #> 95% confidence intervals #> 2.5 % 97.5 % #> theta -0.1350572 0.06509969 #> beta_0 -6.4417802 -4.40893450 #> beta_logHI 1.8146909 2.48286390 #> #> Log likelihood: -2469.765