meanvar.plot
calculates a mean-variance plot for a dataset with many variables (e.g., Warton D. I., Wright S., and Wang, Y. (2012)).
The mean values and variances are calculated across all observations, unless a
formula is given as the first argument which specifies a factor as the dependent
variable. In this latter case the means and variances are calculated separately within the groups defined by these factors.
By default the means and variances of all variables (and all factor levels) are displayed on the same plot. If a formula is given and the explanatory variables contain factor variables, the mean values and variances for each factor level can be calculated and displayed either for all variables together or for each variable separately.
For the latter, set overlay
to FALSE
. The mean-variances corresponding to the different factors will be drawn in different colors, that can be chosen by specifying col
. col
can then either be a single color value (see par
) with the number of values being at least the maximum number of levels of the factors. The same applies to pch
.
If mfrow
is NULL
and mfcol
is NULL
, par("mfrow") is used. If all.labels = FALSE
, only the x-axis labels at the bottom plot and the y-axis labels of plots on the right side of the window are printed if furthermore main=NULL
only the graphics on the top contain the full title, the other ones an abreviated one.
Note, that if a log-transformation is used for displaying the data, a specific mean-variance relation will not be visible in the plot, if either the calculated mean is zero and log!="x"
or log!="xy"
or if the calculated variance
is zero and log!="y"
or log!="xy"
.
By default the y/x ratio of the axis, specified by asp
, will be set to 1
if log!="xy"
. If the mean-variance relation is not displayed on a log scale and overlay
is FALSE
, it is most often not advisable to specify asp
, as there might not be one choice of asp
that is sensible for each of the plots.