[R] how to change strip text of effect plot
Wincent
ronggui.huang at gmail.com
Wed Jan 12 05:06:55 CET 2011
Sure that is one way to go.
Since it is possible to pass lattice arguments to that high level
function, and there should be ways to relabel/custom the strip text in
the lattice plotting system, I would think such an indirect method a
last resort.
Thank you.
Ronggui
On 12 January 2011 11:51, Joshua Wiley <jwiley.psych at gmail.com> wrote:
> Hi,
>
> I am guessing this is not what you meant by "on the fly", but I think
> it will be by far the easiest way. Plotting an effects object is a
> high level plot with a lot of defaults and automation built in to make
> your life simple. The cost is that it is less flexible---you work its
> way, not vice versa. If you want the factor named high, just label it
> that way to begin with. If you think it makes the graphs more
> interpretable/meaningful, then it will make model summaries, etc.
> better also. Worst case, you fit the model twice (one with fancy
> names, one with numbers), which unless you have a massive dataset will
> not take long or be an onerous burden anyways. Here's how you can
> include labels directly in cut():
>
> Cowles$ex2 <- cut(Cowles$extraversion, 3, c("low", "medium", "high"))
> mod.cowles <- glm(volunteer ~ sex+neuroticism*ex2,data=Cowles, family=binomial)
> eff.cowles <- allEffects(mod.cowles)
> plot(eff.cowles, 'neuroticism:ex2',factor.names=F)
>
> Cheers,
>
> Josh
>
> On Tue, Jan 11, 2011 at 7:21 PM, Wincent <ronggui.huang at gmail.com> wrote:
>> Dear r heper,
>>
>> How can I change the strip text, for example (16,23] in the following
>> example, to other more informative text such as "high level" on the
>> fly?
>>
>> library(effects)
>> Cowles$ex2 <- cut(Cowles$extraversion,3)
>> mod.cowles <- glm(volunteer ~ sex+neuroticism*ex2,data=Cowles, family=binomial)
>> eff.cowles <- allEffects(mod.cowles)
>> plot(eff.cowles, 'neuroticism:ex2',factor.names=F)
>>
>> Thank you.
>>
>> Ronggui
>>
>>
>> --
>> Wincent Ronggui HUANG (Ph.D.)
>> City University of Hong Kong
>> http://asrr.r-forge.r-project.org/rghuang.html
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>
--
Wincent Ronggui HUANG (Ph.D.)
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html
More information about the R-help
mailing list