[R] Lmer plot help
andrew.macfarlane at pg.canterbury.ac.nz
Sun Sep 4 23:50:28 CEST 2011
Thanks for that Michael.
My model code, and resultant output, is:
model = lmer(supportive ~ Voice + question +(1|participant), data=voice, family="binomial")
# Estimate Std. Error z value Pr(>|z|)
#(Intercept) 1.3981 0.2140 6.534 6.42e-11 ***
#Voice1 0.5781 0.2340 2.470 0.0135 *
#Voice2 0.5189 0.2333 2.225 0.0261 *
#Voice3 0.2275 0.2205 1.032 0.3022
#Voice4 0.3760 0.2215 1.698 0.0896 .
#question1 -2.2065 0.2213 -9.970 < 2e-16 ***
#question2 -1.6641 0.2188 -7.605 2.86e-14 ***
#question3 -1.1896 0.2211 -5.380 7.46e-08 ***
If I add question to that plot (e.g.plotLMER.fnc(model, pred="Voice, "question"")
, then it looks very messy and essentially unreadable.
I'm looking at how the voice 1) influences support/non-support for the questions. I have already excluded sex/age/ethnicity from my analysis to better fit the model. I'm not near R just now, but look forward to trying your suggestions. While it's in my head, do you know a method for asking the lme to list *ALL* the IVs? I have 5 voices (and 4 questions), but it lists the effects of 4 voices/3questions, similarly if I run summary (model).
Andrew E. MacFarlane
New Zealand Institute of Language, Brain and Behaviour
University of Canterbury | Private Bag 4800
Christchurch | New Zealand 8140
From: Michael Friendly [mailto:friendly at yorku.ca]
Sent: Mon 5/09/2011 7:08 a.m.
To: Andrew MacFarlane
Cc: r-help at r-project.org
Subject: Re: Lmer plot help
On 9/3/2011 7:52 PM, drewmac wrote:
> Hello all
> I'm running the lme4 package on my binomial data, and I'm happy with the
> model and the resultant plot. However, I'd like to plot my table data, which
> has: two IVs, and one DV. You can see an example below, where 'attractive'
> = question (IV), male = condition(IV/predictor) and no/yes = answer (dv).
> I'm using the table to investigate what questions act differently to the
> others, so I can better fit my model. Going through tables of numbers
> doesn't seem the most efficient way of instantly seeing what questions work
> differently, and I'd like to plot that.
Modulo the lme4 reference, for which you provide no data, details, code
or context, you will probably find some suitable visualization methods
in the vcd package, with a tutorial vignette and some extensions in the
These include mosaic plots, fourfold plots, and a variety of specialized
plots within the strucplot framework, which have close
relations to models for n-way frequency tables.
> Here is my code:
> table(finaldata$Voice, finaldata$supportive, finaldata$question)
> #generates my table#
From your description above and the output below, it is not clear
whether you just want to view the associations within this table
or to compare the associations across the elided levels of
finaldata$question. Maybe somethings like [untested]
mytab <- table(finaldata$Voice, finaldata$supportive, finaldata$question)
mosaic(Voice, supportive, data=mytab)
mosaic(supportive ~ Voice|question, data=mytab)
would get you started.
Also, you have 4 levels for finaldata$Voice, which seem to imply
that these might be a 2x2 combination of Voice.gender and Voice.type
or something like that.
> , , = attractive
> no yes
> male1 28 35
> male2 20 22
> female1 21 21
> female2 30 19
> Any help most appreciated.
> View this message in context: http://r.789695.n4.nabble.com/Lmer-plot-help-tp3788613p3788613.html
> Sent from the R help mailing list archive at Nabble.com.
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street Web: http://www.datavis.ca <http://www.datavis.ca/>
Toronto, ONT M3J 1P3 CANADA
This email may be confidential and subject to legal privilege, it may
not reflect the views of the University of Canterbury, and it is not
guaranteed to be virus free. If you are not an intended recipient,
please notify the sender immediately and erase all copies of the message
and any attachments.
Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more
More information about the R-help