[R] help with Tukey Mean-Difference Plot
deepayan at stat.wisc.edu
Sat Aug 16 00:53:13 CEST 2003
"A Tour of Trellis Graphics" ( http://cm.bell-labs.com/cm/ms/departments/sia/
project/trellis/software.writing.html ) says that:
`The tmd function computes a Tukey mean and difference plot. It is unusual
since it takes as an argument the output of one of the other plotting
functions and it produces from that another similar object (of class
trellis). However, for each plot it transforms the data so that the x-axis
holds the mean of the original x- and y-variables and the y-axis gives the
difference. The purpose of this is to allow more effective comparisons.
Instead of comparing how well data fits the y=x line, you can look at how
well the tmd-modified data follows a horizontal line.'
tmd in lattice implements this, and seems to be working OK.
Note that this can work with the output of qq as well as xyplot. This seems to
be more general than what your reference says, which mentions only Q-Q plots.
An example usage of that would be as follows:
x <- rnorm(100)
y <- rnorm(100)
tmd(qq(gl(2, 100) ~ c(x, y)))
To adapt your example, you have to first figure out how to produce the Q-Q
plot you need (for which you would have to play around with your variables a
bit (using reshape, perhaps)), and hopefully calling tmd() then would give
you what you want.
On Friday 15 August 2003 16:15, Frank Mattes wrote:
> Dear R users,
> I would appreciate for some advise how to generate a Tukey
> Mean-Difference Plot with the tmd function part of the lattice
> library. I have two test results (log transformed) which showing a
> correlation on a scatterplot. However the correlation line is
> parallel displaced depending on a clinical condition. I thought to a
> Tukey Mean Difference Plot would show me the difference betweenthe
> two values.
> I don't have the literature how the plot gets constructed, but my
> understanding from
>htm is that the first from each distribution a qq plot is constructed and
> than the coardiantes of the qq-plot are transformed according the
> formula x=x+y/2 and y=x+y.
> I tried this with
> tmd(xyplot(a ~ b| c, data=data)) with
> a and b holding my log10 transformed numerical values, and c the condition.
> However I think I don't get a Tukey Mean-Difference plot. It looks to
> me that only
> x=x+y/2 and y=x+y. transformation is performed (a=a+b; b=b+a/2).
> and the result is displayed as lattice graphic.
> It would be great if anyone could help me to find the error in my plot.
> May thanks
More information about the R-help