# plot_mm: Spaghetti plot and plot of the mean at each time In packHV: A few Useful Functions for Statisticians

## Description

Spaghetti plot and plot of the mean at each time

## Usage

 ```1 2 3``` ```plot_mm(formula, data, col.spag = 1, col.mean = 1, type = "spaghettis", tick.times = TRUE, xlab = NULL, ylab = NULL, main = "", lwd.spag = 1, lwd.mean = 4, ...) ```

## Arguments

 `formula` `obs~time+(group|id)` or `obs~time+(1|id)` `data` data frame in which we can find `obs`, `time`, `group` and `id` `col.spag` vector of length `nrow(data)` with colors (one for each individual) `col.mean` vector of length `length(levels(group))` with colors (one for each group) `type` `"spaghettis"`, `"mean"` or `"both"` `tick.times` boolean, `TRUE` to display ticks at each observation time on the x-axis `xlab` character sring, label of the time axis `ylab` character string, label of the y axis `main` character string, main title `lwd.spag` numeric, width of the spaghetti lines, 1 by default `lwd.mean` numeric, width of the mean lines, 4 by default `...` Other arguments to be passed in `plot`

None

## Author(s)

Hugo Varet on Anais Charles-Nelson's idea

## Examples

 ```1 2 3 4 5 6 7``` ```N=10 time=rep(1:4,N) obs=1.1*time + rep(0:1,each=2*N) + rnorm(4*N) my.data=data.frame(id=rep(1:N,each=4),time,obs,group=rep(1:2,each=N*2)) par(xaxs="i",yaxs="i") plot_mm(obs~time+(group|id),my.data,col.spag=my.data\$group, col.mean=c("blue","red"),type="both",main="Test plot_mm") ```

### Example output

```Loading required package: survival
```

packHV documentation built on May 2, 2019, 5:40 a.m.