run_em: General E-M Algorithm

View source: R/run_em.R

run_emR Documentation

General E-M Algorithm

Description

General E-M Algorithm

Usage

run_em(
  outcome = outcome,
  quality_var = quality_var,
  change_threshold = change_threshold,
  max_iterations = max_iterations,
  min_iterations = min_iterations,
  epsilon = epsilon,
  method = method,
  firth = firth,
  spline_df = spline_df,
  nn = nn,
  em_covariate = NULL,
  em_estimates = NULL,
  em_estimated_beta = NULL,
  em_estimated_basis_weights = NULL,
  em_estimated_ftilde = NULL,
  em_estimated_p = NULL,
  em_fitted_xbeta = NULL,
  em_estimated_f = NULL
)

Arguments

outcome

length-n vector; this is the vector of a target gene's presence/absence; should be coded as 0 or 1

quality_var

length-n vector; this is the quality variable vector, currently p = 1 TODO(turn into n x q matrix)

change_threshold

algorithm will terminate early if the likelihood changes by this percentage or less for 5 iterations in a row for both th

max_iterations

the maximum number of EM steps that the algorithm will run for

min_iterations

the minimum number of EM steps that the algorithm will run for

epsilon

probability of observing a gene when it should be absent; probability between 0 and 1

method

method for estimating f. Defaults to "splines" which fits a monotone spline with df determined by argument spline_df; "isotone" for isotonic regression fit

firth

use firth penalty? Default is TRUE.

spline_df

degrees of freedom (in addition to intercept) to use in monotone spline fit; default 3

nn

length(outcome)

em_covariate

n x p matrix; this is the matrix for the primary predictor/covariate of interest

em_estimates

log likelihood estimates

em_estimated_beta

estimated betas

em_estimated_basis_weights

estimated basis weights

em_estimated_ftilde

estimated f_tilde aka logit(estimated_f)

em_estimated_p

estimated probablities

em_fitted_xbeta

fitted betas

em_estimated_f

estimated f's

Value

An object of class happi.


statdivlab/happi documentation built on April 19, 2024, 2:04 a.m.