plot.xmean.ordinaly vs plot() in package "rms"

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

plot.xmean.ordinaly vs plot() in package "rms"

T.Jon
Would anyone be able to explain what the difference is between
plot.xmean.ordinaly and plot() in the "rms" package? (for the purposes of
testing the proportional odds assumption in ordinal models). In the package
document (https://cran.r-project.org/web/packages/rms/rms.pdf) they seem
both to be used interchangeably.

Thank you!

--
Kim Solve Jacobsen
PhD candidate, Wildlife Conservation Research Unit
University of Oxford
Recanati-Kaplan Centre
OX13 5QL Oxford, UK

[image: Image result for oxford logo]

        [[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: plot.xmean.ordinaly vs plot() in package "rms"

Jeff Newmiller
Read up on S3 object orientation[1]. If you have an object x of class "xmean.ordinaly" then writing

plot(x)

will end up invoking the plot.xmean.ordinaly function rather than the plot.default function in base graphics. This is broadly true throughout R.

[1] http://adv-r.had.co.nz/S3.html

On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen <[hidden email]> wrote:

>Would anyone be able to explain what the difference is between
>plot.xmean.ordinaly and plot() in the "rms" package? (for the purposes
>of
>testing the proportional odds assumption in ordinal models). In the
>package
>document (https://cran.r-project.org/web/packages/rms/rms.pdf) they
>seem
>both to be used interchangeably.
>
>Thank you!

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[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: plot.xmean.ordinaly vs plot() in package "rms"

Jeff Newmiller
Please keep the mailing list included in the thread.

I can't tell if you do understand and are just being sloppy, or if you are completely confused, because xmean.ordinaly() and plot.xmean.ordinaly() are two completely different symbols in R.

As for being "safe"... you may choose to be specific or not, but plot and plot.xmean.ordinaly are both equally "safe" to call, and being too specific can cause problems sometimes as well.

On March 17, 2019 6:40:10 AM PDT, Kim Jacobsen <[hidden email]> wrote:

>Dear Jeff,
>
>Thank you so much! So if I understand the S3 object documents
>correctly,
>the xmean.ordinaly() command and plot() command are interchangeable as
>long
>as x is an object x of class "xmean.ordinaly"? So would I be right to
>think
>that I might as well just xmean.ordinaly() to be safe?
>
>Many thanks,
>
>
>
>On Sun, 17 Mar 2019 at 02:08, Jeff Newmiller <[hidden email]>
>wrote:
>
>> Read up on S3 object orientation[1]. If you have an object x of class
>> "xmean.ordinaly" then writing
>>
>> plot(x)
>>
>> will end up invoking the plot.xmean.ordinaly function rather than the
>> plot.default function in base graphics. This is broadly true
>throughout R.
>>
>> [1] http://adv-r.had.co.nz/S3.html
>>
>> On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen
><[hidden email]>
>> wrote:
>> >Would anyone be able to explain what the difference is between
>> >plot.xmean.ordinaly and plot() in the "rms" package? (for the
>purposes
>> >of
>> >testing the proportional odds assumption in ordinal models). In the
>> >package
>> >document (https://cran.r-project.org/web/packages/rms/rms.pdf) they
>> >seem
>> >both to be used interchangeably.
>> >
>> >Thank you!
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[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: plot.xmean.ordinaly vs plot() in package "rms"

T.Jon
Mailing list now included (apologies, first time I post anything so not
quite sure how it works).

You are quite right, it was a typo. I meant to write that
plot.xmean.ordinaly(). So please let me correct my last statement: the
plot.xmean.ordinaly() command and plot() command are interchangeable as
long as x is an object x of class "xmean.ordinaly", and
plot.xmean.ordinaly() is best used if the object is not of class
"xmean.ordinaly" or if you are unsure what class it it. Is this a correct
encapsulation?


On Sun, 17 Mar 2019 at 14:38, Jeff Newmiller <[hidden email]>
wrote:

> Please keep the mailing list included in the thread.
>
> I can't tell if you do understand and are just being sloppy, or if you are
> completely confused, because xmean.ordinaly() and plot.xmean.ordinaly() are
> two completely different symbols in R.
>
> As for being "safe"... you may choose to be specific or not, but plot and
> plot.xmean.ordinaly are both equally "safe" to call, and being too specific
> can cause problems sometimes as well.
>
> On March 17, 2019 6:40:10 AM PDT, Kim Jacobsen <[hidden email]>
> wrote:
> >Dear Jeff,
> >
> >Thank you so much! So if I understand the S3 object documents
> >correctly,
> >the xmean.ordinaly() command and plot() command are interchangeable as
> >long
> >as x is an object x of class "xmean.ordinaly"? So would I be right to
> >think
> >that I might as well just xmean.ordinaly() to be safe?
> >
> >Many thanks,
> >
> >
> >
> >On Sun, 17 Mar 2019 at 02:08, Jeff Newmiller <[hidden email]>
> >wrote:
> >
> >> Read up on S3 object orientation[1]. If you have an object x of class
> >> "xmean.ordinaly" then writing
> >>
> >> plot(x)
> >>
> >> will end up invoking the plot.xmean.ordinaly function rather than the
> >> plot.default function in base graphics. This is broadly true
> >throughout R.
> >>
> >> [1] http://adv-r.had.co.nz/S3.html
> >>
> >> On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen
> ><[hidden email]>
> >> wrote:
> >> >Would anyone be able to explain what the difference is between
> >> >plot.xmean.ordinaly and plot() in the "rms" package? (for the
> >purposes
> >> >of
> >> >testing the proportional odds assumption in ordinal models). In the
> >> >package
> >> >document (https://cran.r-project.org/web/packages/rms/rms.pdf) they
> >> >seem
> >> >both to be used interchangeably.
> >> >
> >> >Thank you!
> >>
> >> --
> >> Sent from my phone. Please excuse my brevity.
> >>
>
> --
> Sent from my phone. Please excuse my brevity.
>


--
Kim Solve Jacobsen
PhD candidate, Wildlife Conservation Research Unit
University of Oxford
Recanati-Kaplan Centre
OX13 5QL Oxford, UK

[image: Image result for oxford logo]

        [[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: plot.xmean.ordinaly vs plot() in package "rms"

Jeff Newmiller
No. Do not call plot.xmean.ordinaly() if the argument is not of class xmean.ordinaly, because that function assumes that it is such an object.

That is one reason why it is better to call plot() than to be more specific.

On March 19, 2019 3:29:11 PM PDT, Kim Jacobsen <[hidden email]> wrote:

>Mailing list now included (apologies, first time I post anything so not
>quite sure how it works).
>
>You are quite right, it was a typo. I meant to write that
>plot.xmean.ordinaly(). So please let me correct my last statement: the
>plot.xmean.ordinaly() command and plot() command are interchangeable as
>long as x is an object x of class "xmean.ordinaly", and
>plot.xmean.ordinaly() is best used if the object is not of class
>"xmean.ordinaly" or if you are unsure what class it it. Is this a
>correct
>encapsulation?
>
>
>On Sun, 17 Mar 2019 at 14:38, Jeff Newmiller <[hidden email]>
>wrote:
>
>> Please keep the mailing list included in the thread.
>>
>> I can't tell if you do understand and are just being sloppy, or if
>you are
>> completely confused, because xmean.ordinaly() and
>plot.xmean.ordinaly() are
>> two completely different symbols in R.
>>
>> As for being "safe"... you may choose to be specific or not, but plot
>and
>> plot.xmean.ordinaly are both equally "safe" to call, and being too
>specific
>> can cause problems sometimes as well.
>>
>> On March 17, 2019 6:40:10 AM PDT, Kim Jacobsen
><[hidden email]>
>> wrote:
>> >Dear Jeff,
>> >
>> >Thank you so much! So if I understand the S3 object documents
>> >correctly,
>> >the xmean.ordinaly() command and plot() command are interchangeable
>as
>> >long
>> >as x is an object x of class "xmean.ordinaly"? So would I be right
>to
>> >think
>> >that I might as well just xmean.ordinaly() to be safe?
>> >
>> >Many thanks,
>> >
>> >
>> >
>> >On Sun, 17 Mar 2019 at 02:08, Jeff Newmiller
><[hidden email]>
>> >wrote:
>> >
>> >> Read up on S3 object orientation[1]. If you have an object x of
>class
>> >> "xmean.ordinaly" then writing
>> >>
>> >> plot(x)
>> >>
>> >> will end up invoking the plot.xmean.ordinaly function rather than
>the
>> >> plot.default function in base graphics. This is broadly true
>> >throughout R.
>> >>
>> >> [1] http://adv-r.had.co.nz/S3.html
>> >>
>> >> On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen
>> ><[hidden email]>
>> >> wrote:
>> >> >Would anyone be able to explain what the difference is between
>> >> >plot.xmean.ordinaly and plot() in the "rms" package? (for the
>> >purposes
>> >> >of
>> >> >testing the proportional odds assumption in ordinal models). In
>the
>> >> >package
>> >> >document (https://cran.r-project.org/web/packages/rms/rms.pdf)
>they
>> >> >seem
>> >> >both to be used interchangeably.
>> >> >
>> >> >Thank you!
>> >>
>> >> --
>> >> Sent from my phone. Please excuse my brevity.
>> >>
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[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: plot.xmean.ordinaly vs plot() in package "rms"

Bert Gunter-2
In reply to this post by T.Jon
Please study the documentation to which you were referred. This list is not
appropriate for comprehensive tutorials, which is what you need, although
all help is of course in some sense a tutorial.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Mar 20, 2019 at 6:30 AM Kim Jacobsen <[hidden email]> wrote:

> Mailing list now included (apologies, first time I post anything so not
> quite sure how it works).
>
> You are quite right, it was a typo. I meant to write that
> plot.xmean.ordinaly(). So please let me correct my last statement: the
> plot.xmean.ordinaly() command and plot() command are interchangeable as
> long as x is an object x of class "xmean.ordinaly", and
> plot.xmean.ordinaly() is best used if the object is not of class
> "xmean.ordinaly" or if you are unsure what class it it. Is this a correct
> encapsulation?
>
>
> On Sun, 17 Mar 2019 at 14:38, Jeff Newmiller <[hidden email]>
> wrote:
>
> > Please keep the mailing list included in the thread.
> >
> > I can't tell if you do understand and are just being sloppy, or if you
> are
> > completely confused, because xmean.ordinaly() and plot.xmean.ordinaly()
> are
> > two completely different symbols in R.
> >
> > As for being "safe"... you may choose to be specific or not, but plot and
> > plot.xmean.ordinaly are both equally "safe" to call, and being too
> specific
> > can cause problems sometimes as well.
> >
> > On March 17, 2019 6:40:10 AM PDT, Kim Jacobsen <[hidden email]>
> > wrote:
> > >Dear Jeff,
> > >
> > >Thank you so much! So if I understand the S3 object documents
> > >correctly,
> > >the xmean.ordinaly() command and plot() command are interchangeable as
> > >long
> > >as x is an object x of class "xmean.ordinaly"? So would I be right to
> > >think
> > >that I might as well just xmean.ordinaly() to be safe?
> > >
> > >Many thanks,
> > >
> > >
> > >
> > >On Sun, 17 Mar 2019 at 02:08, Jeff Newmiller <[hidden email]>
> > >wrote:
> > >
> > >> Read up on S3 object orientation[1]. If you have an object x of class
> > >> "xmean.ordinaly" then writing
> > >>
> > >> plot(x)
> > >>
> > >> will end up invoking the plot.xmean.ordinaly function rather than the
> > >> plot.default function in base graphics. This is broadly true
> > >throughout R.
> > >>
> > >> [1] http://adv-r.had.co.nz/S3.html
> > >>
> > >> On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen
> > ><[hidden email]>
> > >> wrote:
> > >> >Would anyone be able to explain what the difference is between
> > >> >plot.xmean.ordinaly and plot() in the "rms" package? (for the
> > >purposes
> > >> >of
> > >> >testing the proportional odds assumption in ordinal models). In the
> > >> >package
> > >> >document (https://cran.r-project.org/web/packages/rms/rms.pdf) they
> > >> >seem
> > >> >both to be used interchangeably.
> > >> >
> > >> >Thank you!
> > >>
> > >> --
> > >> Sent from my phone. Please excuse my brevity.
> > >>
> >
> > --
> > Sent from my phone. Please excuse my brevity.
> >
>
>
> --
> Kim Solve Jacobsen
> PhD candidate, Wildlife Conservation Research Unit
> University of Oxford
> Recanati-Kaplan Centre
> OX13 5QL Oxford, UK
>
> [image: Image result for oxford logo]
>
>         [[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: plot.xmean.ordinaly vs plot() in package "rms"

Michael Dewey-3
In reply to this post by T.Jon
Dear Kim

See inline

On 19/03/2019 22:29, Kim Jacobsen wrote:

> Mailing list now included (apologies, first time I post anything so not
> quite sure how it works).
>
> You are quite right, it was a typo. I meant to write that
> plot.xmean.ordinaly(). So please let me correct my last statement: the
> plot.xmean.ordinaly() command and plot() command are interchangeable as
> long as x is an object x of class "xmean.ordinaly", and
> plot.xmean.ordinaly() is best used if the object is not of class
> "xmean.ordinaly" or if you are unsure what class it it. Is this a correct
> encapsulation?
>

I think the best way to think about it is that plot() looks at whatever
you gave it to plot and then looks at all the plot methods it knows
about to see if it has one which matches the class of whatever you gave
it. It then uses that one. In general unless you know you need to
override that behaviour you should never need to explicitly use any of
the other plot methods. The same applies to all the other methods like
print() summary() and so on.

Michael

>
> On Sun, 17 Mar 2019 at 14:38, Jeff Newmiller <[hidden email]>
> wrote:
>
>> Please keep the mailing list included in the thread.
>>
>> I can't tell if you do understand and are just being sloppy, or if you are
>> completely confused, because xmean.ordinaly() and plot.xmean.ordinaly() are
>> two completely different symbols in R.
>>
>> As for being "safe"... you may choose to be specific or not, but plot and
>> plot.xmean.ordinaly are both equally "safe" to call, and being too specific
>> can cause problems sometimes as well.
>>
>> On March 17, 2019 6:40:10 AM PDT, Kim Jacobsen <[hidden email]>
>> wrote:
>>> Dear Jeff,
>>>
>>> Thank you so much! So if I understand the S3 object documents
>>> correctly,
>>> the xmean.ordinaly() command and plot() command are interchangeable as
>>> long
>>> as x is an object x of class "xmean.ordinaly"? So would I be right to
>>> think
>>> that I might as well just xmean.ordinaly() to be safe?
>>>
>>> Many thanks,
>>>
>>>
>>>
>>> On Sun, 17 Mar 2019 at 02:08, Jeff Newmiller <[hidden email]>
>>> wrote:
>>>
>>>> Read up on S3 object orientation[1]. If you have an object x of class
>>>> "xmean.ordinaly" then writing
>>>>
>>>> plot(x)
>>>>
>>>> will end up invoking the plot.xmean.ordinaly function rather than the
>>>> plot.default function in base graphics. This is broadly true
>>> throughout R.
>>>>
>>>> [1] http://adv-r.had.co.nz/S3.html
>>>>
>>>> On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen
>>> <[hidden email]>
>>>> wrote:
>>>>> Would anyone be able to explain what the difference is between
>>>>> plot.xmean.ordinaly and plot() in the "rms" package? (for the
>>> purposes
>>>>> of
>>>>> testing the proportional odds assumption in ordinal models). In the
>>>>> package
>>>>> document (https://cran.r-project.org/web/packages/rms/rms.pdf) they
>>>>> seem
>>>>> both to be used interchangeably.
>>>>>
>>>>> Thank you!
>>>>
>>>> --
>>>> Sent from my phone. Please excuse my brevity.
>>>>
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>
>
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
[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.