Learn R Programming

compositions (version 1.40-2)

pwlrPlot: Plots of pairwise logratio against a covariable.

Description

Creates a matrix of plots, with each pairwise logratio against a covariable. The covariable can be numeric or factor, and play the role of X or Y axis.

Usage

pwlrPlot(x,y,...,add.line=FALSE,line.col=2,add.robust=FALSE,rob.col=4)

Arguments

x

a vector, a column of a data.frame, or an acomp representing the first set of things to be displayed. Either x or y must be an acomp object, and the other must be a covariable. Both factors and continuous covariables allowed here.

y

a vector, a column of a data.frame, or an acomp representing the first set of things to be displayed. Either x or y must be an acomp object, and the other must be a covariable. Factors to be used here with caution.

furter parameters to the panel function

add.line

logical, to control the addition of a regression line in each panel. Ignored if covariable is a factor.

line.col

in case the regression line is added, which color should be used? Defaults to red.

add.robust

logical, to control the addition of a robust regression line in each panel. Ignored if covariable is a factor. This is nowadays based on lmrob, but this can change in the future.

rob.col

in case the robust regression line is added, which color should be used? Defaults to blue.

Details

This function generates a matrix of plots of all possible pairwise logratios of the acomp argument, plotted against a covariable. The covariable can be a factor or a numeric vector, or a column of a matrix or data.frame. Covariable and composition can both be represented in X or Y axis: a factor on X axis generates a boxplot; a factor on Y axis generates a spineplot; if the covariable is numeric, a default scatterplot is generated. All dot arguments are passed to these plotting functions. In any of these cases, the diagram shows the logratio of the component in the row divided by the component in the column. In the case of a numeric covariable, both classical and robust regression lines can be added.

References

Boogaart, K.G. v.d. , R. Tolosana (2008) Mixing Compositions and Other scales, Proceedings of CodaWork 08.

http://ima.udg.es/Activitats/CoDaWork03

http://ima.udg.es/Activitats/CoDaWork05

http://ima.udg.es/Activitats/CoDaWork08

See Also

plot.aplus, pairwisePlot, boxplot, spineplot, plot.default

Examples

Run this code
# NOT RUN {
data(Hydrochem)
xc = acomp(Hydrochem[,c("Ca","Mg","Na","K")])
fk = Hydrochem$River
pH = -log10(Hydrochem$H)
## x=acomp, y=factor 
pwlrPlot(xc, fk, border=2:5)
## x=factor, y=acomp
pwlrPlot(fk,xc, col=2:5)
## x=acomp, y=numeric, with colors by river
pwlrPlot(xc, pH, col=as.integer(fk)+1)
## x=numeric, y=acomp, with line
pwlrPlot(pH, xc, add.robust=TRUE)

# }

Run the code above in your browser using DataLab