# [R] SpreadLevelPlot for more than one factor

Ashim Kapoor ashimkapoor at gmail.com
Tue Jan 9 16:18:34 CET 2018

```Dear Sir,

I have a query.

I have a whole set of distributions which should be made normal /
homoscedastic. Take for instance the warpbreaks data set.

We have the following boxplots for the warpbreaks dataset:

a. boxplot(breaks ~ wool)
b. boxplot(breaks ~ tension)
c. boxplot(breaks ~ interaction(wool,tension))
d. boxplot(breaks ~ wool @ each level of tension)
e. boxplot(breaks ~ tension @ each level of wool)

Now should we not be making a-e normal and homoscedastic? Should we not
make a giant collection of boxplots from a-e and use the SpreadLevelPlot on
this entire collection?

A second query : (d) and (e) are the distribution of the simple effects of
factor wool and tension @ each level of the other. Is that correct?  Are
(a) and (b) the distribution of the main effect of wool and tension? Please
confirm.

Best Regards,
Ashim

On Sun, Jan 7, 2018 at 8:05 PM, Fox, John <jfox at mcmaster.ca> wrote:

> Dear Ashim,
>
> Try spreadLevelPlot(breaks ~ interaction(tension, wool), data=warpbreaks) .
>
> I hope this helps,
>  John
>
> -----------------------------
> John Fox, Professor Emeritus
> McMaster University
> Web: socialsciences.mcmaster.ca/jfox/
>
>
>
> > -----Original Message-----
> > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Ashim
> > Kapoor
> > Sent: Sunday, January 7, 2018 12:08 AM
> > To: r-help at r-project.org
> > Subject: [R] SpreadLevelPlot for more than one factor
> >
> > Dear All,
> >
> > I want a transformation which will make the spread of the response at
> all
> > combinations of  2 factors the same.
> >
> > See for example :
> >
> > boxplot(breaks ~ tension * wool, warpbreaks)
> >
> > The closest I  can do is :
> >
> wool ,
> > warpbreaks)
> >
> > I want to do :
> >
> > spreadLevelPlot(breaks ~tension * wool, warpbreaks)
> >
> > But I get :
> >
> > > spreadLevelPlot(breaks ~tension * wool , warpbreaks)
> > Error in spreadLevelPlot.formula(breaks ~ tension * wool, warpbreaks) :
> >   right-hand side of model has more than one variable
> >
> > What is the corresponding appropriate function for 2 factors ?
> >
> > Many thanks,
> > Ashim
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help