# Visualize the density of the data over the environmental data

Source:`R/partial.R`

`partial_density.Rd`

Based on a fitted model, plot the density of observations over the estimated variable and environmental space. Opposed to the partial and spartial functions, which are rather low-level interfaces, this function provides more detail in the light of the data. It is also able to contrast different variables against each other and show the used data.

## Usage

```
partial_density(mod, x.var, df = FALSE, ...)
# S4 method for ANY,character
partial_density(mod, x.var, df = FALSE, ...)
```

## Details

This functions calculates the observed density of presence and absence points over the whole surface of a specific variable. It can be used to visually inspect the fit of the model to data.

## References

Warren, D.L., Matzke, N.J., Cardillo, M., Baumgartner, J.B., Beaumont, L.J., Turelli, M., Glor, R.E., Huron, N.A., Simões, M., Iglesias, T.L. Piquet, J.C., and Dinnage, R. 2021. ENMTools 1.0: an R package for comparative ecological biogeography. Ecography, 44(4), pp.504-511.

## Examples

```
if (FALSE) {
# Do a partial calculation of a trained model
partial_density(fit, x.var = "Forest.cover")
# Or with two variables
partial_density(fit, x.var = c("Forest.cover", "bio01"))
}
```