---
title: "Detecting inflammation"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Detecting inflammation}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup, echo = FALSE}
library(micronutr)
```

Inflammation, and its different stages, can be assessed based on the the levels of acute-phase proteins - one of either *c-reactive protein (CRP)* or *α1-acid-glycoprotein (AGP)*, or both. 

### Classifying inflammation based on CRP or AGP only

The classification of inflammation status based on either CRP or AGP only is shown in the table below.

**Acute-phase Protein** | **Cut-off Points**
:--- | :---
CRP | > 5 microgram/L
AGP | > 1 g/L

The function `detect_inflammation_crp()` classifies *c-reactive protein* levels based on the cut-off point shown above to detect inflammation. For example, if CRP is at 2 microgram/L,

```{r micronutr5, echo = TRUE}
detect_inflammation_crp(crp = 2)
```

the individual is classified as not having inflammation.

We can also set the function to provide simple integer codes to classify inflammation by setting the `label` argument to FALSE.

```{r micronutr6, echo = TRUE}
detect_inflammation_crp(crp = 2, label = FALSE)
```

In this case, an integer code of 0 is provided to indicate a no inflammation status. This would be useful in workflows that require/prefer integer codes for binary classification.

The function `detect_inflammation_agp()` classifies *α1-acid-glycoprotein (AGP)* levels based on the cut-off point shown above to detect inflammation. For example, if AGP is at 1.5 g/L,

```{r micronutr7, echo = TRUE}
detect_inflammation_agp(agp = 1.5)
```

the individual is classified as having inflammation.

We can also set the function to provide simple integer codes to classify inflammation by setting the `label` argument to FALSE.

```{r micronutr8, echo = TRUE}
detect_inflammation_agp(agp = 1.5, label = FALSE)
```

In this case, an integer code of 1 is provided to indicate inflammation status. This would be useful in workflows that require/prefer integer codes for binary classification.

These functions are useful for classifying inflammation when data for only one of active-phase proteins is available.

### Classifying inflammation based on both CRP and AGP

The detailed classification of inflammation status based on the combination of CRP and AGP is shown in the table below.

**Inflammation Status** | **Cut-off Points**
:--- | :--- |
Incubation | CRP > 5 microgram/L and AGP <= 1 g/L
Early convalescence | CRP > 5 microgram/L and AGP > 1 g/L
Late convalescence | CRP <= 5 microgram/L and AGP > 1 g/L

The function `detect_inflammation()` accepts values for both CRP and AGP to classify inflammation status. For example, an individual with CRP of 2 microgram/L and AGP of 1.5 g/L,

```{r micronutr9, echo = TRUE}
detect_inflammation(crp = 2, agp = 1.5)
```

the individual is classified as being in late convalescence.

We can also set the function to provide simple integer codes to classify inflammation by setting the `label` argument to FALSE.

```{r micronutr10, echo = TRUE}
detect_inflammation(crp = 2, agp = 1.5, label = FALSE)
```

In this case, an integer code of 3 is provided to indicate late convalescence status. This would be useful in workflows that require/prefer integer codes for classification.

The `detect_inflammation()` function can also be used for assessing inflammation status using only one of the active-phase proteins. Using the earlier example of an individual with a CRP of 2 µg/L,

```{r micronutr11, echo = TRUE}
detect_inflammation(crp = 2)
```

we get the same result as using the `detect_inflammation_crp()`.

## References

C-reactive protein concentrations as a marker of inflammation or infection for interpreting biomarkers of micronutrient status. Vitamin and Mineral Nutrition Information System. Geneva: World Health Organization; 2014.

<br/>
<br/>
