probz's accessor includes a warning that it is modifying the value.
## TODO Dangerous to have accessor do something more than return the value of it
## slot. Further
## probz(object) <- probz(object)
## will not behave as expected
#' @rdname probz-method
#' @aliases probz,MixtureModel-method
setMethod("probz", "MixtureModel", function(object) {
## because first iteration not saved
object@probz/(iter(object)-1)
})
I think that probz is written this way because it carries unscaled probabilities that are added to during model fitting. The CPP functions update_probz_batch and compute_probz support this. R functions combine_batch, combine_multibatch_pooled and .computeProbz also have code that indicate that the probabilities must be rescaled to add up to 1.
Coercion methods do not seem to account for this rescaling. Should these, and other functions that act as constructors, copy the probz matrix directly using a slot accessor?
As currently defined, the matrix rows in a CopyNumberModel's probz slot is scaled to add up to 1. As a result, the rowSums of probz(cn.model) or probCopyNumber(cn.model) add up to 1/(cn.model@mcmc.parms@iter - 1)
probz's accessor includes a warning that it is modifying the value.I think that probz is written this way because it carries unscaled probabilities that are added to during model fitting. The CPP functions
update_probz_batchandcompute_probzsupport this. R functionscombine_batch,combine_multibatch_pooledand.computeProbzalso have code that indicate that the probabilities must be rescaled to add up to 1.Coercion methods do not seem to account for this rescaling. Should these, and other functions that act as constructors, copy the probz matrix directly using a slot accessor?
As currently defined, the matrix rows in a CopyNumberModel's
probzslot is scaled to add up to 1. As a result, the rowSums ofprobz(cn.model)orprobCopyNumber(cn.model)add up to1/(cn.model@mcmc.parms@iter - 1)