# Section 1: Practicals

## (i) *Fish, tanks and food*

An experimenter investigating the effect of different food for a species of fish places the food in tanks containing the fish. The weight increase of the fish is the response (y<sub>ijk</sub>), where i,j and k are indices identifying the type of food, the tank and the fish, respectively.

* Please, identify fixed and random effects. <br/>
* Please, identify predictable and unpredictable (i.e. error) random effects. <br/> 
* Please, write the equation of a reasonable regression model generating the response. <br/>

*Note:* this example has been taken from the following reference: Casella, George (2008). Statistical design. Berlin: Springer. ISBN 978-0-387-75965-4.
<br>
<br>

## (ii) *Anticancer activity of carboplatin combined with nivolumab*
In a preclinical *in vivo* experiment the efficacy of carboplatin combined with nivolumab was tested. A mouse model for NSCLC was used. The statistical design is reported in the following flow-chart and has the following characteristics: 

![](../ppts/Statistical_design.jpeg)


<br/>
1. The experimental groups were: <br/>
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; n.1: Vehicle <br/>
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; n.2: Carboplatin <br/> 
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; n.3: Nivolumab <br/> 
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; n.4: Carboplatin plus nivolumab <br/>
2. A blocked randomisation by gender and baseline tumour volume was used to ensure balanced groups and high probability to detect an antineoplastic synergy between chemotherapic (i.e. carboplatin) and immunotherapic (i.e. nivolumab) compounds. Two batches of animals were used. The first batch was randomised in April, the second batch was randomised in May. <br/>
3. The primary response, tumour volume (mm<sup>3</sup>), was assessed at baseline and daily in the subsequent two weeks. At baseline and in the first week it was assessed by the operator Mark, in the second week by the operator Peter. <br/>

* Please, identify fixed effects. <br/>
* Please, identify random effects. <br/>
* Please, identify crossed and nested effects. <br/>
<br>

## (iii) *Systematic component of regression models*

The relationship between response FEV (lung capacity) and predictors age (x<sub>1</sub>), height (x<sub>2</sub>), gender (x<sub>3</sub>), smoking status (x<sub>4</sub>) and place of residence (x<sub>5</sub>) could be described by the following systematic components:

||||||||||||||
|:----|:----|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|
|$\mu$|=|$\beta$<sub>0</sub>|+|$\beta$<sub>1</sub>x<sub>1</sub>|+|$\beta$<sub>2</sub>x<sub>2</sub>|+|$\beta$<sub>3</sub>x<sub>3</sub>|+|$\beta$<sub>4</sub>x<sub>4</sub>|+|$\beta$<sub>5</sub>x<sub>5</sub>|
|1/$\mu$|=|0|+|e<sup>$\beta$<sub>1</sub>x<sub>1</sub></sup>|+|$\beta$<sub>2</sub>x<sub>2</sub><sup>(1/3)</sup>|+|0|+|$\beta$<sub>4</sub>x<sub>4</sub>|+|0|
|log<sub>e</sub>$\mu$|=|$\beta$<sub>0</sub>|+|0|+|$\beta$<sub>2</sub>x<sub>2</sub>|+|$\beta$<sub>3</sub>x<sub>3</sub><sup>2</sup>|+|$\beta$<sub>4</sub>x<sub>4</sub>|+|$\beta$<sub>5</sub>x<sup>5</sup>|
|$\mu$|=|$\beta$<sub>0</sub>|+|$\beta_1$x<sub>1</sub><sup>(1/2)</sup>|+|0|+|0|+|0|+|$\beta$<sub>5</sub>x<sub>5</sub>|
|||||||||||||

* Please, for each systematic component:
  1. identify the number of predictors
  2. identify the number of regression parameters
  3. is the mean FEV of the UK population analysed on natural scale?
  4. is the systematic component linear in the parameters?
  5. could the systematic component be used in a linear regression model?
<br>

* Can you give a meaning for the parameter $\beta$<sub>0</sub>?
<br>
<br>

# (iiii) *Noisy miners and number of eucalypt trees*

The data for this exercise are available in R as the data frame *nminer*, part of the **GLMsData** package<sup>1</sup>.  <br/>
Lets starts by <br/>

* installing the **GLMsData** package in R  <br/>
* loading the **GLMsData** package and the *nminer* data frame  <br/>
* displaying the first lines of data as follows:  <br/>

```{r message = FALSE, warning = FALSE, echo = TRUE, eval=TRUE} 
# install.packages("GLMData")  # Install the GLMsData package
library(GLMsData)              # Load the GLMsData package
data(nminer)                   # Make the data set nminer available for use
head(nminer)                   # Display the first few lines of data
```
The noisy miner is a small but aggressive native Australian bird. A study<sup>2</sup> of the habitats of the noisy miner recorded the _number of noisy miners_ (that is, the number observed; column `Minerab`) in two hectare transects located in buloke woodland patches with varying _numbers of eucalypt trees_ ( column `Eucs`). 

* Please, plot the _number of noisy miners_ against the number of _numbers of eucalypt trees_ by means of a scatter plot.
```{r message = FALSE, warning = FALSE, echo = TRUE, eval=TRUE} 
plot( jitter(Minerab) ~ Eucs, data=nminer, las=1, ylim=c(0, 20),
      xlab="Number of eucalypts per 2 ha", ylab="Number of noisy miners" )
```

* Consider _number of noisy miners_ as response and _numbers of eucalypt trees_ as predictor. <br/>
  1. Is the relationship between the mean _number of noisy miners_ ($\mu$) and the _numbers of eucalypt trees_ linear? <br/>
  2. Does the random component have a constant variance?
  3. Could the normal distribution reasonably describe the random component?
  4. Is it possible to describe the distribution of the _number of noisy miners_ as function of _numbers of eucalypt trees_ using a linear regression model?
  5. Please, propose a reasonable regression model generating these data

*Note:* this example has been taken from the following reference: Dunn, Peter K. and Gordon K. Smyth. “Generalized Linear Models With Examples in R.” (2018). <br/>
*References*: <br/>
<sup>1</sup> Dunn, P.K., Smyth, G.K.: GLMsData: Generalized linear model data sets (2017). URL <https://CRAN.R-project.org/package=GLMsData>. <br/>
<sup>2</sup> Maron, M.: Threshold effect of eucalypt density on an aggressive avian competitor. Biological Conservation 136, 100–107 (2007)