[R] how to change strip text of effect plot
Joshua Wiley
jwiley.psych at gmail.com
Wed Jan 12 04:51:34 CET 2011
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/
More information about the R-help
mailing list