Skip to contents

Title

Usage

EM_algorithm_reduced(
  fixed_side = "RC",
  extra_row = FALSE,
  ecoff = NA,
  visible_data,
  model = "surv",
  mu_formula = Surv(time = left_bound, time2 = right_bound, type = "interval2") ~
    pspline(t, df = 0, caic = TRUE),
  pi_formula = c == "2" ~ s(t),
  max_it = 3000,
  ncomp = 2,
  tol_ll = 1e-06,
  browse_at_end = FALSE,
  browse_each_step = FALSE,
  plot_visuals = FALSE,
  prior_step_plot = FALSE,
  pause_on_likelihood_drop = FALSE,
  pi_link = "logit",
  verbose = 3,
  model_coefficient_tolerance = 1e-05,
  maxiter_survreg = 30,
  initial_weighting = 1,
  sd_initial = 0.2,
  stop_on_likelihood_drop = FALSE,
  non_linear_term = "t",
  covariates = NULL,
  scale = NULL
)

Arguments

fixed_side

String, if using a reduced model, specify which component the algorithm won't estimate mu for. "RC" corresponds to the upper component, "LC" corresponds to the lower. NULL if using the full model.

extra_row

Logical, if using a reduced model, the highest ("RC") or lowest ("LC") MIC value may be included in the set observations weighted as possibly in the fixed component

ecoff

String or numeric, represents the largest MIC value of the WT distribution on MIC scale. Model will use this in combination with the fixed side to assume the observations on the non-fixed side of the ecoff are not part of the component on the fixed side of the ecoff. Can be a number on the MIC scale: 32 or a string representation of WT classification "<=32", should be inclusive

visible_data

Data frame, data including the left and right bound of the MICs (use import_mics_with_metadata to format correctly) and any covariates (including the non-linear term)

model

String, "pspline" or "polynomial". Which non-linear term should be used in model

mu_formula

A formula for a survreg object from the survival package, left side of equation should be a surv object using "interval2" format, right side should be the non-linear term (polynomial or pspline) and any covariates. Can be a single formula or a list of formulas where length is equal to the number of components where the trend in the mean is being estimated.

pi_formula

Formula, for the component weight model. Model is fit using mgcv's gam function. Nonlinear terms include s() and lo(). Basis of s() function can be changed using bs argument to s(). Use c == "2" for the left side of the formula.

max_it

Numeric, maximum number of iterations for the EM algorithm for any given model fitting.

ncomp

Numeric, number of components to be fitted. When fitting a reduced model where one component is not estimated, that component should still contribute to the value in ncomp. E.g. a reduced model where the upper component is fixed and mu for the lower component is being estimated has a value of ncomp = 2.

tol_ll

Numeric, maximum tolerance for change in likelihood between steps of the algorithm for model convergence to be achieved.

browse_at_end

For internal model testing

browse_each_step

For internal model testing

plot_visuals

For internal model testing

prior_step_plot

For internal model testing

pause_on_likelihood_drop

For internal model testing

String: "logit" or "identity", link function for the generalized linear model fit for the pi model (component weights).

verbose

Numeric, controls amount of information printed during model fitting

model_coefficient_tolerance

Numeric, maximum tolerance for change in model coefficients (insluding spline terms) between steps of the algorithm for model convergence to be achieved.

maxiter_survreg

Maximum iterations used in survreg model fitting, default is 30.

initial_weighting

For the reduced model fitting: 1 sets initial weights corresponding to fixed side (and extra_row) where observations not outside the range on the side corresponding to the fixed side are forced to be in the component where mu is being estimated. For initial weighting two a linear model is fit for the component still being estimated to provide initial observation weights.

sd_initial

Numeric, value greater than 0 and less than 1. Proportion of the range from the highest concentration to lowest concentration that is used as the initial estimate of sigma for the estimated components. Default is 0.2

stop_on_likelihood_drop

For internal model testing

non_linear_term

String, non-linear term to be included in the model. Variable in the pspline term in the pspline model or in the polynomial term in the polynomial model.

covariates

String, covariates to be included in mu model aside from the non-linear term.