Learn R Programming

RJaCGH (version 1.1.1)

collapseChain: Collapse several parallel chains ('RJaCGH' objects)

Description

method to join or collapse several 'RJaCGH' objects, for use in every method of class 'RJaCGH'.

Usage

collapseChain(obj)
## S3 method for class 'RJaCGH':
collapseChain(obj)
## S3 method for class 'RJaCGH.genome':
collapseChain(obj)
## S3 method for class 'RJaCGH.Chrom':
collapseChain(obj)
## S3 method for class 'RJaCGH.array':
collapseChain(obj)

Arguments

obj
a list containing several parallel chains; that is objects of any of RJaCGH, RJaCGH.Chrom, RJaCGH.genome, RJaCGH.array classes (obviously, all of the same class).

Value

  • An object of the same class as any of the list obj.

Details

If several parallel chains are run and if they converge (see gelman.brooks.plot) they should be joined in one. This is what this method does. Please note that this function returns only one object, so one can not call later gelman.brooks.plot.

References

Oscar M. Rueda and Ramon Diaz Uriarte. A flexible, accurate and extensible statistical method for detecting genomic copy-number changes. http://biostats.bepress.com/cobra/ps/art9/. {http://biostats.bepress.com/cobra/ps/art9/}.

See Also

RJaCGH, summary.RJaCGH, model.averaging, plot.RJaCGH, states, trace.plot, collapseChain

Examples

Run this code
y <- c(rnorm(100, 0, 1), rnorm(10, -3, 1), rnorm(20, 3, 1),
       rnorm(100,0, 1)) 
Pos <- sample(x=1:500, size=230, replace=TRUE)
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=10, TOT=1000, k.max = 4,
                    jump.parameters=jp)
fit.genome <- list()
for (i in 1:4) {
fit.genome[[i]] <- RJaCGH(y=y, Pos=Pos, Chrom=Chrom, model="genome",
burnin=10, TOT=1000, jump.parameters=jp, k.max = 4)
}

gelman.brooks.plot(fit.genome)
##If all R seem to be round 1
fit.genome <- collapseChain(fit.genome)

Run the code above in your browser using DataLab