mishery
unread,Aug 18, 2008, 3:44:41 AM8/18/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CorpLing with R
The newer LanguageR package contains a function written by Harald for
plotting mixed models.
Below are bits copied from the documentation. It is is the interaction
bit that I am messing up as I can plot a version of the model without
the interaction.
******************
Usage
plotLMER.fnc(model, xlabel = NA, ylabel = NA, ylimit = NA, fun = NA,
pred = NA, n = 100, intr = NA, mcmcMat = NA, lockYlim = TRUE,
addlines = FALSE, withList = FALSE, cexsize = 0.5, ...)
********************
intr
a list specifying an interaction to be graphed; obligatory arguments
are (1) the
name of the interaction variable, followed by (2) a vector of values
for that
variable, followed by (3) the position for interaction labels
(’"beg"’, ’"mid"’, or
’"end"’, or ’NA’ if no labels are desired), optionally followed by (4)
a list with as
first element a vector of colors and as second element a vector of
line types. The
number of elements in both vectors should match the number of values
specified
under (2) for the interaction predictor.
********************************
This the code given that I am trying to adapt. Here a three-way
interaction LogWordFreq*LogAffixFreq*Sex in an initial model is being
examined by splitting the data by sex and running separate models.
********************************
males.lmer = lmer(LogRT ~ PC1 + PC2 + PrevError + Rank +
ResidSemRating + ResidFamSize + LogWordFreq*LogAffixFreq +
poly(LogCUP, 2, raw=TRUE) + LogUP + LogCUPtoEnd +
plotLMER.fnc 89
(1|Subject) + (1|Word) + (1|Affix), data = males)
females.lmer = lmer(LogRT ~ PC1 + PC2 + PrevError + Rank +
ResidSemRating + ResidFamSize + LogWordFreq*LogAffixFreq +
poly(LogCUP, 2, raw=TRUE) + LogUP + LogCUPtoEnd +
(1|Subject) + (1|Word) + (1|Affix), data = females)
femMCMC = pvals.fnc(females.lmer, nsim=500, withMCMC=TRUE,
addPlot=FALSE)
# for which we then plot the interaction
# of word frequency by affix frequency
par(mfrow=c(2,2),mar=c(5,5,2,2))
plotLMER.fnc(females.lmer, pred = "LogAffixFreq",
intr=list("LogWordFreq", round(quantile(females$LogWordFreq),3),
"beg",
list(c("red", "green", "blue", "yellow", "purple"), rep(1,5))),
ylimit=c(6.5,7.0),
mcmcMat=femMCMC$mcmc, xlabel = "log affix frequency", ylabel = "log RT
auditory lexical decision")
mtext("females", line=0.5, cex=0.8)
plotLMER.fnc(males.lmer, pred = "LogAffixFreq",
intr=list("LogWordFreq", round(quantile(males$LogWordFreq),3), "beg",
list(c("red", "green", "blue", "yellow", "purple"), 1:5)),
ylimit=c(6.5,7.0))
mtext("males", line=0.5, cex=0.8)
plotLMER.fnc(females.lmer, pred = "LogWordFreq",
intr=list("LogAffixFreq", round(quantile(females$LogAffixFreq),3),
"beg"),
ylimit=c(6.5,7.0), cexsize=1.2)
mtext("females", line=0.5, cex=0.8)
plotLMER.fnc(males.lmer, pred = "LogWordFreq",
intr=list("LogAffixFreq", round(quantile(males$LogAffixFreq),3),
"end"),
ylimit=c(6.5,7.0), cexsize=1.0)
mtext("males", line=0.5, cex=0.8)
par(mfrow=c(1,1))
Will post my attempt at code soon