R/foehnix.R
, R/foehnix_functions.R
foehnix.Rd
This is the main method of the foehnix package to estimate two-component mixture models for automated foehn classification.
foehnix(
formula,
data,
switch = FALSE,
filter = NULL,
family = "gaussian",
control = foehnix.control(family, switch, ...),
...
)
# S3 method for foehnix
logLik(object, ...)
# S3 method for foehnix
nobs(object, ...)
# S3 method for foehnix
AIC(object, ...)
# S3 method for foehnix
BIC(object, ...)
# S3 method for foehnix
IGN(object, ...)
# S3 method for foehnix
edf(object, ...)
# S3 method for foehnix
print(x, ...)
# S3 method for foehnix
formula(x, ...)
# S3 method for foehnix
summary(object, eps = 1e-04, detailed = FALSE, ...)
an object of class formula
(or one that can be coerced
to that class): a symbolic description of the model to be fitted. The
details of model specification are given under 'Details'.
a regular (not necessarily strictly regular)
time series object of class zoo
containing the
variables for the two-part mixture model.
logical. If set to TRUE
the two estimated components
will be switched. This is important if the covariate for the components
(left hand side of input formula
is smaller for cases with foehn than
for cases without foehn, e.g., when using the temperature difference as main
covariate.
a named list can be provided to apply a custom (simple) filter
to the observations on data
. Can be used to e.g., prespecify a
specific wind sector for foehn winds. Please read the manual of the
foehnix_filter
method for more details and examples.
character (at the moment "gaussian"
or "logistic"
)
or an object of class foehnix.family
.
additional control arguments, see foehnix.control
.
forwarded to foehnix.control
a foehnix
object (input for S3 methods)
a foehnix
object (input for S3 methods)
threshold for posterior probabilities used in summary
.
numeric
value, default 1e-4
.
boolean, default FALSE
. If TRUE
, additional information
will be returned.
Returns an object of class foehnix
.
Log-likelihood sum (numeric
).
Number of observations (integer
) used to train the model.
Returns the Akaike information criterion (numeric
).
Bayesian information criterion (numeric
).
Ignorance (mean negative log-likelihood; numeric
).
Effective degrees of freedom.
Returns the formula of the model (formula
).
Object of class summary.foehnix
.
The two-component mixture model can be specified via formula object where
the left hand side of the formula contains the 'main' variable explaining the two
components (only one variable), the right hand side of the formula specifies
the concomitant variables (multiple variables allowed). As an example:
let's assume that our zoo object data
contains the following
columns:
ff
: observed wind speed at target site
rh
: observed relative humidity at target site
diff_t
: (potential) temperature difference between target site and a station
upstream of the foehn wind direction
The specification for formula
could e.g. look as follows:
ff ~ 1
: the two components of the mixture model will be
based on the observed wind speed (ff
), no concomitant
model (right hand side is simply 1
).
ff ~ rh
: similar to the specification above, but using
observed relative humidity (rh
) as concomitant.
ff ~ rh + diff_t
: as above but with an additional second
concomitant variable (observed temperature difference, diff_t
).
diff_t ~ ff + rh
: using temperature difference as the main
variable for the two components while ff
and rh
are
used as concomitants. Note: in this case it will be required to set
switch = TRUE
as lower values of diff_t
indicate
less stratified conditions where the occurrence of foehn is
more likely. If switch = FALSE
the two components (foehn
and no foehn) may be interchanged and the model will return
"probabilities of not observing foehn".
Note that these are just examples and have to be adjusted given data
availability, location, structure/names of the variables in the data
object.
The optional input filter
allows to specify simple or complex
filters (see foehnix_filter
for details).
This allows to add additional constraints, e.g., adding a filter on the
observed wind direction to ensure that only events within a specific wind
sector (the main foehn wind direction) are classified as "foehn".
Plavcan D, Mayr GJ, Zeileis A (2014). Automatic and Probabilistic Foehn Diagnosis with a Statistical Mixture Model. Journal of Applied Meteorology and Climatology. 53(3), 652--659. doi:10.1175/JAMC-D-13-0267.1
Gr\"un B, Leisch F (2007). Fitting Finite Mixtures of Generalized Linear Regressions in R. Computational Statistics \& Data Analysis. 51(11), 5247--5252. doi:10.1016/j.csda.2006.08.014
Gr\"un B, Leisch F (2008). FlexMix Version 2: Finite Mixtures with Concomitant Variables and Varying and Constant Parameters. Journal of Statistical Software, Articles. 28(4), 1--35. doi:10.18637/jss.v028.i04
Fraley C, Raftery AE (2002). Model-Based Clustering, Discriminant Analysis, and Density Estimation. Journal of the American Statistical Association. 97(458), 611--631. doi:10.1198/016214502760047131
See foehnix_filter
for more information about the
filter
option. See also: tsplot
, windrose
.
Foehnix family objects: foehnix.family
.
S3 methods for foehnix
objects:
plot.foehnix
,
predict.foehnix
,
fitted.foehnix
,
print.foehnix
,
summary.foehnix
,
windrose.foehnix
,
coef.foehnix
,
nobs.foehnix
,
edf.foehnix
,
AIC.foehnix
,
BIC.foehnix
,
IGN.foehnix
,
logLik.foehnix
,
...