estModelMaybe is a high-order function which
turns an estimator for a model over a dataspace, t,
into an estimator for a corresponding "model-maybe" over the
dataspace Maybe t,
i.e. where a datum may or may not be missing.
There are at least two options for modelling missing-ness:
If missing-ness is non-informative and not to be inferred,
a fixed distribution, "50:50" say, can be used to "model" it.
If missing-ness is to be estimated, use the option
m1 = estMultiState (map present dataSet).
estModelMaybe :: ([t]->ModelType t) -> [Maybe t] -> ModelType (Maybe t)
estModelMaybe estModel dataSet =
let present (Just _) = True
present Nothing = False
-- m1 = estMultiState (map present dataSet) -- model missing-ness
m1 = fiftyFifty -- don't est' missing-ness
m2 = estModel (map (\(Just x) -> x) (filter present dataSet))
in modelMaybe m1 m2
modelMaybe is a "high-order" function which
takes a model of Boolean (for missing-ness) and
a model over data-space, t, and produces
the corresponding model over the
dataspace Maybe t.
(NB. "quotes" in this case because models are
made of functions, rather than literally being functions,
whereas estimators are functions.)
modelMaybe :: (ModelType Bool) -> (ModelType t) -> ModelType (Maybe t)
modelMaybe m1 m2 = -- Model of Bool -> Model of T -> Model of Maybe T
let negLogPr (Just x) = (nlPr m1 True) + (nlPr m2 x) -- present
negLogPr Nothing = nlPr m1 False -- missing
in MnlPr (msg1 m1 + msg1 m2)
(\() -> "(Maybe " ++ showsPrec 0 m1 ("," ++ show m2 ++ ")"))
See the mixed Bayesian network
case-study for an example of the use of
models for missing data.
The types of estModelMaybe and modelMaybe
can be generalised somewhat, but this will do for a start.