Learn R Programming

languageR (version 1.5.0)

lmerPlotInt.fnc: Plot the interaction of two linear numeric predictors in a model fitted with lmer

Description

Visualization of an interaction in a model fitted with lmer of two numeric predictors.

Usage

lmerPlotInt.fnc(lmermodel, xname, yname, intxyname, 
                qntls = seq(0, 1, by = 0.1), view = 30, 
                addStdError = FALSE, ndigits = 2, nlev = 30, 
                which = "matplot", shadow = 0.5, colour = "lightblue", 
                fun  = NA, ylabel = NA, ...)

Arguments

lmermodel

an lmer model object

xname

name (character string) of first numeric predictor

yname

name (character string) of second numeric predictor

intxyname

name (character string) of the interaction in the lmer summary

qntls

vector of values to be shown for the second numeric predictor, defaults to deciles

view

specifies the viewing parameter theta for the perspective plot

addStdError

add noise with the standard deviation of the residual error in the lmer model to the plot

ndigits

number of digits to show for the second numeric predictor

nlev

number of levels for the contour plot

which

choices are "matplot" (default), "contour", "persp", "image", and "all", in which case a 2 by 2 panel is shown with all four plots

shadow

the amount of shade for the perspective plot

colour

the color used for the perspective plot, defaults to "lightblue"

fun

for matplot displays, a function for transforming the predicted response

ylabel

string, to be added to the Y-axis as y label

...

other arguments

Value

A plot is shown on the graphics device.

Warning

This function should not be used to plot interactions when one of the predictors also has quadratic or higher terms in the model.

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  require(lme4)
  require(optimx)
	lexdec.lmer = lmer(RT~BNCw*Frequency+(1|Subject)+(1|Word), data=lexdec,
    control=lmerControl(optimizer="optimx",optCtrl=list(method="nlminb")))
	lmerPlotInt.fnc(lexdec.lmer, "BNCw", "Frequency", "BNCw:Frequency", 
    which="matplot")
# }
# NOT RUN {
  
# }

Run the code above in your browser using DataLab