SpreadLevelPlot for more than one factor

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

SpreadLevelPlot for more than one factor

Ashim Kapoor
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 :

spreadLevelPlot(breaks ~tension , warpbreaks)
spreadLevelPlot(breaks ~ 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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: SpreadLevelPlot for more than one factor

Ashim Kapoor
Dear All,

we need to do :

library(car) for the spreadLevelPlot function

I forgot to say that.

Apologies,
Ashim

On Sun, Jan 7, 2018 at 10:37 AM, Ashim Kapoor <[hidden email]> wrote:

> 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 :
>
> spreadLevelPlot(breaks ~tension , warpbreaks)
> spreadLevelPlot(breaks ~ 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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: SpreadLevelPlot for more than one factor

Ashim Kapoor
Dear All,

I did this :

> v = wool:tension
> spreadLevelPlot(breaks ~ v)
    LowerHinge Median UpperHinge Hinge-Spread
B:H         15     17         21            6
A:M         18     21         30           12
A:H         18     24         28           10
B:M         21     28         39           18
B:L         20     29         31           11
A:L         26     51         54           28

Suggested power transformation:  -0.2756176

So the ans is approximately  = -.2

My query is:corresponding to  p , what is the corresponding power
transformation defined as? Is it x^p  or (x^p -1) / p ?

Which one of the following is the final transformation ? Please clarify.
> boxplot(breaks ^ -.2 ~v)
> boxplot((breaks^-.2 -1)/(-.2)~v)
>

Best Regards,
Ashim

On Sun, Jan 7, 2018 at 10:59 AM, Ashim Kapoor <[hidden email]> wrote:

> Dear All,
>
> we need to do :
>
> library(car) for the spreadLevelPlot function
>
> I forgot to say that.
>
> Apologies,
> Ashim
>
> On Sun, Jan 7, 2018 at 10:37 AM, Ashim Kapoor <[hidden email]>
> wrote:
>
>> 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 :
>>
>> spreadLevelPlot(breaks ~tension , warpbreaks)
>> spreadLevelPlot(breaks ~ 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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: SpreadLevelPlot for more than one factor

Fox, John
In reply to this post by Ashim Kapoor
Dear Ashim,

Try spreadLevelPlot(breaks ~ interaction(tension, wool), data=warpbreaks) .

I hope this helps,
 John

-----------------------------
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: socialsciences.mcmaster.ca/jfox/



> -----Original Message-----
> From: R-help [mailto:[hidden email]] On Behalf Of Ashim
> Kapoor
> Sent: Sunday, January 7, 2018 12:08 AM
> To: [hidden email]
> 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 :
>
> spreadLevelPlot(breaks ~tension , warpbreaks) spreadLevelPlot(breaks ~ 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]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: SpreadLevelPlot for more than one factor

Ashim Kapoor
Dear Sir,

Many thanks for your reply.

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 <[hidden email]> wrote:

> Dear Ashim,
>
> Try spreadLevelPlot(breaks ~ interaction(tension, wool), data=warpbreaks) .
>
> I hope this helps,
>  John
>
> -----------------------------
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> Web: socialsciences.mcmaster.ca/jfox/
>
>
>
> > -----Original Message-----
> > From: R-help [mailto:[hidden email]] On Behalf Of Ashim
> > Kapoor
> > Sent: Sunday, January 7, 2018 12:08 AM
> > To: [hidden email]
> > 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 :
> >
> > spreadLevelPlot(breaks ~tension , warpbreaks) spreadLevelPlot(breaks ~
> 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]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> > guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: SpreadLevelPlot for more than one factor

Fox, John
Dear Ashim,

I’ll address your questions briefly but they’re really not appropriate for
this list, which is for questions about using R, not general statistical
questions.

(1) The relevant distribution is within cells of the wool x tension
cross-classification because it’s the deviations from the cell means that
are supposed to be normally distributed with equal variance. In the
warpbreaks data there are only 9 cases per cell. If you examine all of
these deviations simultaneously, that’s equivalent to examining the
residuals from the two-way ANOVA model fit to the data.

(2) Yes, (d) and (e) visualize simple effects, and (a) and (b) visualize
main effects, the latter only because the data are balanced.

Best,
 John

-------------------------------------
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: http://socserv.mcmaster.ca/jfox/




On 2018-01-09, 10:18 AM, "Ashim Kapoor" <[hidden email]> wrote:

>Dear Sir,
>
>
>Many thanks for your reply.
>
>
>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
><[hidden email]> wrote:
>
>Dear Ashim,
>
>Try spreadLevelPlot(breaks ~ interaction(tension, wool), data=warpbreaks)
>.
>
>I hope this helps,
> John
>
>-----------------------------
>John Fox, Professor Emeritus
>McMaster University
>Hamilton, Ontario, Canada
>Web:
>socialsciences.mcmaster.ca/jfox/ <http://socialsciences.mcmaster.ca/jfox/>
>
>
>
>> -----Original Message-----
>> From: R-help [mailto:[hidden email]] On Behalf Of Ashim
>> Kapoor
>> Sent: Sunday, January 7, 2018 12:08 AM
>> To: [hidden email]
>> 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 :
>>
>> spreadLevelPlot(breaks ~tension , warpbreaks) spreadLevelPlot(breaks ~
>>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]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>
>https://stat.ethz.ch/mailman/listinfo/r-help
><https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide
>http://www.R-project.org/posting- <http://www.R-project.org/posting->
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: SpreadLevelPlot for more than one factor

Ashim Kapoor
Dear Sir,

Many thanks and Best Regards,
Ashim.

On Sun, Jan 14, 2018 at 9:05 PM, Fox, John <[hidden email]> wrote:

> Dear Ashim,
>
> I’ll address your questions briefly but they’re really not appropriate for
> this list, which is for questions about using R, not general statistical
> questions.
>
> (1) The relevant distribution is within cells of the wool x tension
> cross-classification because it’s the deviations from the cell means that
> are supposed to be normally distributed with equal variance. In the
> warpbreaks data there are only 9 cases per cell. If you examine all of
> these deviations simultaneously, that’s equivalent to examining the
> residuals from the two-way ANOVA model fit to the data.
>
> (2) Yes, (d) and (e) visualize simple effects, and (a) and (b) visualize
> main effects, the latter only because the data are balanced.
>
> Best,
>  John
>
> -------------------------------------
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> Web: http://socserv.mcmaster.ca/jfox/
>
>
>
>
> On 2018-01-09, 10:18 AM, "Ashim Kapoor" <[hidden email]> wrote:
>
> >Dear Sir,
> >
> >
> >Many thanks for your reply.
> >
> >
> >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
> ><[hidden email]> wrote:
> >
> >Dear Ashim,
> >
> >Try spreadLevelPlot(breaks ~ interaction(tension, wool), data=warpbreaks)
> >.
> >
> >I hope this helps,
> > John
> >
> >-----------------------------
> >John Fox, Professor Emeritus
> >McMaster University
> >Hamilton, Ontario, Canada
> >Web:
> >socialsciences.mcmaster.ca/jfox/ <http://socialsciences.mcmaster.ca/jfox/
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: R-help [mailto:[hidden email]] On Behalf Of Ashim
> >> Kapoor
> >> Sent: Sunday, January 7, 2018 12:08 AM
> >> To: [hidden email]
> >> 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 :
> >>
> >> spreadLevelPlot(breaks ~tension , warpbreaks) spreadLevelPlot(breaks ~
> >>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]]
> >>
> >> ______________________________________________
> >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>
> >https://stat.ethz.ch/mailman/listinfo/r-help
> ><https://stat.ethz.ch/mailman/listinfo/r-help>
> >> PLEASE do read the posting guide
> >http://www.R-project.org/posting- <http://www.R-project.org/posting->
> >> guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> >
> >
> >
> >
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.