---
output: 
  html_document:
    css: help.css
    
params:
  compartment: sediment
---

```{r setup, include = FALSE, echo = FALSE}

library(knitr)
knit_engines$set(asis = function(options) {
  if (options$echo && options$eval) knit_child(text = options$code)
})

options(width = 110)

source("report functions.R")

load(file.path("meta analysis objects", "MSTAT investigation.RData"))
assessment <- get(params$compartment)
```

## Screening of MSTAT for `r params$compartment`

<p class = "startsmall">
This document is to help examine whether the classification of stations as baseline (B), representative (RH) and impacted (IH) is reasonable.  For the purposes of the MIME assessment:
</p>

<ul type = "disc">
<li>Baseline stations are those that are near-pristine or only subject to diffuse inputs.  Baseline stations will be used in the meta-analyses of status.  However, they will be excluded from the meta-analyses of trend because any trends there are likely to due to different processes than the trends in representative stations.</li>
<li>Impacted stations are those close to a point source. Impacted stations will be removed from the meta-analyses of both status and trend, because they are not representative of contaminants at a regional scale.</li>
<li class = "last">Representative stations are all the rest. We think of stations being representative in the broadest sense./li>
</ul>     

<br>


### Original classification {.tabset}

<p class = "startsmall">
Here are all the `r params$compartment` stations for which a parametric model for at least one chemical determinand.  The stations are coloured according to their MSTAT as given in the station dictionary, with the following modifications:

<ul type = "disc">
<li>Missing values are treated as representative</li>
<li>Stations which have ID status (impacted due to dredging) have been turned into representative (because not IH - impacted due to hazardous substances).</li>
<li class = "last">Stations which have RP status (representative due to physical processes) have been turned into RH./li>
</ul> 

<p class = "botsmall">
Baseline, representative and impacted stations are coloured blue, green and red respectively.  (NB this colour scheme has nothing to do with the status of the chemical concentrations found there; it just reflects the MSTAT values they have been assigned, with blue, green and red provide an intuitive key.)
</p>

<br>

```{r include = FALSE}
out <- NULL
for (regionID in as.character(1:4)) {
  MSTATid <- "MSTATedited"
  out <- c(out, knit_child('MSTAT_summary_byregion.Rmd'))
}
```

```{r, echo=FALSE, results="asis"}
cat(paste(out, collapse = '\n'))
```

<br>

### Revised classification {.tabset}

<p class = "startsmall">
Here is the revised classification based on discussions at MIME 2015:
</p>

<br>

```{r include = FALSE}
out <- NULL
for (regionID in as.character(1:4)) {
  MSTATid <- "MSTAT"
  out <- c(out, knit_child('MSTAT_summary_byregion.Rmd'))
}
```

```{r, echo=FALSE, results="asis"}
cat(paste(out, collapse = '\n'))
```

<br>

### Data availability

<p class = "startsmall">
More station details can be found in `r paste0("MSTAT ", params$compartment, ".csv")`.  The column MSTATsubmitted contains the values in station dictionary, MSTATedited contains the minor modifications such as replacing missing values with RH, and MSTAT contains the revised classification based on discussions at MIME 2015. 
</p>
