# 'plot' method for RJaCGH objects

### Description

A plot is drawed with information from the fit of a RJaCGH object.

### Usage

1 2 3 4 5 |

### Arguments

`x` |
any of RJaCGH, RJaCGH.Chrom, RJaCGH.Genome, RJaCGH.array objects |

`array` |
Name of the array to be plotted. If NULL, the weigthed average of the arrays is plotted. |

`k` |
Model to plot (i.e., number of hidden states). If NULL, the most visited is taken (only if a single array is plotted and a single model (genome/chromosome). |

`Chrom` |
Chromosome to be plotted (only if a single array is plotted and a different model for each chromosome has been fitted. |

`show` |
one of "average" or "frequency". See details. |

`weights` |
vector of weights for each array. Must have the length of the number of arrays. If NULL, the weights are uniform. |

`model.averaging` |
if TRUE, |

`cex` |
A numerical value giving the amount by which plotting text and symbols should be scaled relative to the default. |

.

`smoother` |
Logical. Smoothed means by model averaging. |

`...` |
additional arguments passed to plot. |

### Details

Depending on the object and the parameters passed,
a different plot is drawed:
If `array`

in the case of a single model to all genome or
`array`

and `Chrom`

in the case of a different model to
each chromosome are passed, a panel with 5 subplots is
returned. The first one is a barplot with the posterior distribution
of the number of hidden states. The second and third are a density
plot of the posterior distribution of means and variances. The four
one is the probability of staying in the same hidden state, as
returned by `plotQNH`

, and the last one shows the
original observations colored by thir hidden state and the probability
of being in that hidden state.

On every plot, the 'Normal' state is coloured black. The 'Gain' states are red and the 'Loss' ones green.

If `array`

is NULL and `show`

is 'average', the last
one of the plots is drawn, but the hidden state sequence and its
probability is computed averaging on all the arrays with weights
according to `weights`

vector. If `show`

is 'frequency',
again the last plot is drawn, but the percentage of arrays in
which every gene is Gain/Lost is shown, weighted by the
`weights`

vector.

If `smoother`

is TRUE, the smoothed mean is drawn. See
`smoothMeans`

, except when
`show`

is 'frequency'.

### Value

A plot.

### Author(s)

Oscar M. Rueda and Ramon Diaz Uriarte

### References

Rueda OM, Diaz-Uriarte R. Flexible and Accurate Detection of Genomic Copy-Number Changes from aCGH. PLoS Comput Biol. 2007;3(6):e122

### See Also

`RJaCGH`

,
`smoothMeans`

,
`summary.RJaCGH`

, `modelAveraging`

,
`states`

, `trace.plot`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ```
## Not run:
y <- c(rnorm(100, 0, 1), rnorm(10, -3, 1), rnorm(20, 3, 1), rnorm(100,
0, 1))
Pos <- round(runif(230))
Pos <- cumsum(Pos)
Chrom <- rep(1:23, rep(10, 23))
jp <- list(sigma.tau.mu=rep(0.5, 4), sigma.tau.sigma.2=rep(0.3, 4),
sigma.tau.beta=rep(0.7, 4), tau.split.mu=0.5, tau.split.beta=0.5)
fit.Chrom <- RJaCGH(y=y, Pos=Pos, Chrom=Chrom, model="Chrom",
burnin=100, TOT=1000, jump.parameters=jp, k.max=4)
fit.Genom <- RJaCGH(y=y, Pos=Pos, Chrom=Chrom, model="Genome", burnin=100,
TOT=1000, jump.parameters=jp, k.max=4)
fit.none <- RJaCGH(y=y, Pos=Pos, Chrom=NULL, model="None",
burnin=100, TOT=1000, jump.parameters=jp, k.max=4)
plot(fit.Chrom)
plot(fit.Chrom, array="array1")
plot(fit.Genom)
plot(fit.none)
y2 <- c(rnorm(100, 0, 1), rnorm(10, -3, 1), rnorm(20, 3, 1),
rnorm(100, 0, 1))
ya <- cbind(y, y2)
fit.Chrom.array <- RJaCGH(y=ya, Pos=Pos, Chrom=Chrom, model="Chrom",
burnin=100, TOT=1000, jump.parameters=jp, k.max=4)
fit.Genom.array <- RJaCGH(y=ya, Pos=Pos, Chrom=Chrom, model="Genome",
burnin=100, TOT=1000, jump.parameters=jp, k.max=4)
fit.none.array <- RJaCGH(y=ya, Pos=Pos, Chrom=NULL, model="None",
burnin=100, TOT=1000, jump.parameters=jp, k.max=4)
plot(fit.Chrom.array)
plot(fit.Genom.array)
plot(fit.none.array)
## End(Not run)
``` |