The foehnix mixture models are based on a set of families provided with this
package. Currently, the package provides a two-component Gaussian and a
two-component logistic mixture model and their truncated and censored
versions. Custom foehn.family
objects could also be plugged in (see
'Details' section).
# S3 method for foehnix.family
print(x, ...)
# Check if truncation is set
is.truncated(x, ...)
# Check if left censoring/truncation limit has been specified
has.left(x, ...)
# Check if right censoring/truncation limit has been specified
has.left(x, ...)
# Logistic mixture-model family
foehnix_logistic()
# Censored logistic mixture-model family
foehnix_clogistic(left = -Inf, right = Inf)
# Truncated logistic mixture-model family
foehnix_tlogistic(left = -Inf, right = Inf)
# Gaussian mixture-model family
foehnix_gaussian()
# Censored Gaussian mixture-model family
foehnix_cgaussian(left = -Inf, right = Inf)
# Truncated Gaussian mixture-model family
foehnix_tgaussian(left = -Inf, right = Inf)
foehnix.family
object.
additional arguments, ignored.
left censoring or truncation point (if the family object provides this option).
right censoring or truncation point (if the family object provides this option).
The method foehnix
allows to specify a family
input
argument which has to be either "gaussian"
(the default) or
"logistic"
for now. If finite arguments for left
and/or
right
are set as well, a censored Gaussian/logistic mixture model
will be estimated (or truncated, if truncated = TRUE
; see
foehnix
and foehnix.control
).
However, feel free to develop custom family objects if needed: if a
foehnix.family
object is provided on family
when calling
foehnix
this custom object will be used. For example:
fam <- foehnix:::foehnix_cgaussian(left = 0)
mod <- foehnix(dt ~ ff + dd + rh, data = data, family = fam)
Each `foehn.family` object consists of a set of functions:
optional arguments not listed here (stored inside the object environment when specified on initialization,
left
and right
used for the censored and truncated
Gaussian/logistic families are such examples).
name
: character, name of the family object.
d
: density function of the mixture distribution.
p
: distribution function of the mixture distribution.
r
: not required for optimization but nice for testing:
returns random numbers from the mixed distribution to simulate data.
loglik
function returning the log-likelihood sum,
used for model estimation (EM algorithm).
posterior
returns the (updated) posterior probabilities,
used for model estimation (EM algorithm).
theta
returns the parameters of the distributions of the
components of the mixture models. Used for model
estimation (EM algorithm).
Examples are: `foehnix_gaussian`, `foehnix_cgaussian`, `foehnix_tgaussian`, `foehnix_logistic`, `foehnix_clogistic`, and `foehnix_tlogistic` in `R/families.R`.