Given a generative model of the type we propose, and an alternate version (saturated "S", sample-independent "US", gene-independent "UG" or gene/variant interaction independent "UI"), either produces the estimated observations on the training dataset or calculates residual deviance between models.
training_data: (list) Likely the 'train' component of a call to get_mutation_tables().
gen_model: (list) A generative model - result of a call to fit_gen_model*().
alt_gen_model: (list) An alternative generative model.
alt_model_type: (character) One of "S" (saturated), "US" (sample-independent), "UG", (gene-independent), "UI" (gene/variant-interaction independent).
gene_lengths: (dataframe) A gene lengths data frame.
calculate_deviance: (logical) If TRUE, returns residual deviance statistics. If FALSE, returns training data predictions.
Returns
If calculate_deviance = FALSE:
A list with two entries, est_mut_vec and alt_est_mut_vec, each of length n_samples x n_genes x n_mut_types, giving expected mutation value for each combination of sample, gene and variant type in the training dataset under the two models being compared.
If calculate_deviance = TRUE:
A list with two entries, deviance and df, corresponding to the residual deviance and residual degrees of freedom between the two models on the training set.