---
title: "FFTrees: Fast and frugal decision trees"
author: "Nathaniel D. Phillips"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
bibliography: fft.bib
csl: apa.csl
vignette: >
  %\VignetteIndexEntry{FFTrees package overview}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, echo = F, message = F, results = 'hide'}
library(FFTrees)
library(knitr)
```

## Fast and Frugal Trees (FFTrees)

```{r fig.align = "center", out.width="250px", echo = FALSE}
knitr::include_graphics("../inst/FFTrees_Logo.jpg")
```



```{r, fig.width = 7, fig.height = 7, echo = T, fig.align='center', echo = TRUE}
# Create an FFT from the heartdisease dataset
heart.fft <- FFTrees(formula = diagnosis ~.,
                     data = heartdisease)

# Plot the best training tree
plot(heart.fft,
     main = "Heart Disease",
     decision.names = c("Absent", "Present"))
```

A fast and frugal tree (FFT) is a set of hierarchical rules for making decisions based on very little information (usually 4 or fewer). For example, the tree above uses data from to decide whether a patient truly has heart disease or not based on up to 3 pieces of information.

FFTrees are simple, transparent decision strategies that use minimal information to make decisions [see @gigerenzer1999fast;@gigerenzer1999good]. They are frequently preferable to more complex decision strategies (such as Logistic Regression) because they rarely over-fit data [@gigerenzer2009homo] and are easy to interpret and implement in real-world decision tasks [@marewski2012heuristic]. They have been used in real world tasks from detecting depression [@jenny2013simple], to making fast decisions in emergency rooms [@green1997alters].

The purpose of the `FFTrees` package is to produce, compare, and display FFTs. The main function in the package is `FFTrees()` which takes formula `formula` and dataset `data` arguments and returns several FFTs which attempt to classify training cases into criterion classes. For additional details and examples, check out the vignettes below:

## Vignettes

- [Creating FFTrees with FFTrees()](FFTrees_function.html)
- [How FFTrees grows trees](FFTrees_algorithm.html)
- [Visualizing FFTrees with plot()](FFTrees_plot.html)
- [Lots of example FFTrees](FFTrees_examples.html)

## Datasets

The package contains several datasets taken from the [UCI Machine Learning Repository](http://archive.ics.uci.edu/ml/) that you can use to play around with FFTrees.

- `heartdisease` -- patients suspected of having heart disease [source](http://archive.ics.uci.edu/ml/datasets/Heart+Disease)
- `breastcancer` -- patients suspected of having breast cancer [source](https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+(Diagnostic))
- `titanic` -- records of which passengers on the Titanic survived
- `forestfires` -- forest fire statistics [source](http://archive.ics.uci.edu/ml/datasets/Forest+Fires)
- `wine` -- ratings of wine quality [source](http://archive.ics.uci.edu/ml/datasets/Wine)
- `income` -- Census data from > 30,000 US residents [source](http://archive.ics.uci.edu/ml/datasets/Adult)
- `bank` -- Bank marketing dataset [source](http://archive.ics.uci.edu/ml/datasets/Bank+Marketing)

## Contact

This package is constantly being updated. The latest developer version is always at [https://github.com/ndphillips/FFTrees](https://github.com/ndphillips/FFTrees). For comments, tips, additional references, and bug reports, please add an issue at [https://github.com/ndphillips/FFTrees/issues](https://github.com/ndphillips/FFTrees/issues) or email me at Nathaniel.D.Phillips.is@gmail.com

## Bibliography
