Build Status codecov Repository Status Python

A Toolbox for Automated Foehn Classification based on Mixture Models

foehnix package provides a toolbox for automated probabilistic foehn wind classification based on two-component mixture models (foehn mixture models). foehnix models are a special case of the general flexible mixture model class (Fraley 2002, Leisch 2004, Grün 2007, Grün 2008), an unsupervised statistical model to identify unobserveable clusters or components in data sets.

The application of mixture models for an automated classification of foehn winds has first been proposed by Plavcan et al. (2014). The “Community Foehn Classification Experiment” shows that the method performs similar compared to another semi-automatic classification, foehn experts, students, and weather enthusiasts (see Mayr 2019).

Aim of this software package:

  • provide easy-to-use functions for classification
  • create probabilistic foehn classification
  • easy scalability (can be applied to large data sets)
  • reproducibility of the results
  • create results which are comparable to other locations

First Steps

Installation

The package is not yet published via the Comprehensive R Archive Network (CRAN) but will be made available as soon as finished. Currently the package has to be downloaded/installed via github which can be done in different ways. Note that the foehnix package comes with routines written in C. Thus, on Windows, the Rtools have to be installed to be able to compile the C code!

Via the R package remotes

The R package remotes allows one to install packages from github via the R command line interface using the function install_github. By default, remotes installes the latest version of the master branch. However, feel free to install one of our earlier releases (show release candidates).

# Load library 'remotes'. If not yet installed, call
# install.packages("remotes") first.
library("remotes")

# Install package (automatically resolves required dependencies)
install_github("retostauffer/Rfoehnix")

# Or install a specific release candiate (here v0.1-2)
install_github("retostauffer/Rfoehnix@v0.1-2")
asdf

By cloning the repository

Or do it the good old way via git clone (Note: dependencies have to be installed manually):

# Change directory
cd <somewhere/on/your/local/disc>

# Clone repository
git clone https://github.com/retostauffer/Rfoehnix.git foehnix

Afterwards use your preferred way to install local packages. E.g., using devtools or remotes:

# Use remotes
remotes::install_local("foehnix")

# Using devtools
devtools::install("foehnix")

For Command Shell Fans

Fans of the good old console can of course use the good old way.

# Change directory
cd <somewhere/on/your/local/disc>

# Clone repository
git clone https://github.com/retostauffer/Rfoehnix.git foehnix

# Feel free to use on of our release candidates which
# might miss some features, but might also be more stable.
# A list of release candidates can be found on:
# - https://github.com/retostauffer/Rfoehnix/releases
(cd foehnix && git checkout tags/<tagname> && cd ..)

# Install directly
R CMD INSTALL foehnix

# OR
R CMD build foehnix
R CMD INSTALL foehnix_<version>.tar.gz

Import observation data

The foehnix package depends on the R package zoo (Z’s Ordered Observations), a package/object to handle (un-)regular time series data. Import data as zoo is relatively straight forward for those being used to R. For all others, we provide a small “how-to” which can be found here:

More information is provided in the “Reading Data into zoo” vignette of the R package zoo.

Create classification

Once the observation data have been imported, one can start doing the classification. The foehnix package comes with two demo data sets, one for Southern California (USA) and one for Tyrol (A). The documentation provides a walk-through on how to start using foehnix:

Reto, Matthias, Georg, and Fabien.

References

Mayr GJ, Plavcan D, Laurence A, Elvidge A, Grisogono B, Horvath K, Jackson P, Neururer A, Seibert P, Steenburgh JW, Stiperski I, Sturman A, Večenaj Ž, Vergeiner J, Vosper S, Zängl G (2018). The Community Foehn Classification Experiment. Bulletin of the American Meteorological Society, 99(11), 2229—2235, 10.1175/BAMS-D-17-0200.1

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, 10.1175/JAMC-D-13-0267.1

Hastie T, Tibshirani R, Friedman J (2009). Fitting Logistic Regression Models. In The Elements of Statistical Learning (Chapter 4.4.1), 2nd edition, ISBN 978-0387848570. PDF download

Grün B, Friedrich L (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

Grün B, Leisch F (2007). Fitting Finite Mixtures of Generalized Linear Regressions in R. Computational Statistics & Data Analysis, 51(11), doi:10.1016/j.csda.2006.08.014

Friedrich L (2004). FlexMix: A General Framework for Finite Mixture Models and Latent Class Regression in R. Journal of Statistical Software, Articles, 11(8), 1—18, doi:10.18637/jss.v011.i08

Fraley C, Raftery AE (2000). Model-Based Clustering, Discriminant Analysis, and Density Estimation. Journal of the American Statistical Association, 97(458), 611—631, doi:10.1198/016214502760047131

McCullagh P, Nelder JA (1999). Likelihood functions for binary data. In Generalized Linear Models (Chapter 4.4), 2nd edition, ISBN 0-412-31760-5.