influenceFun: Identify highly influential data points.

Description Usage Arguments Examples

Description

Use influence.mer from the influence.ME package. Influential observations and/or groups are identified as being above the critical threshold of 4/N, where N is the number of unique observations or groups.

Usage

1
2
influenceFun(model, model.variable, data, group.variable,
  inf.type = c("observations", "groups"), plot = T, ...)

Arguments

model

A merMod object from lme4.

model.variable

Character. The name of the random effect variable to be computed.

data

An optional data frame used in model

group.variable

Character. Grouping variable for plots

inf.type

Character vector. Specifying which type of influential variables are returned

plot

Logical. Should a plot be produced?

...

Other arguments passed to ciFun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
require(lme4)
m1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
inf1<-influenceFun(model=m1, model.variable= "Days", data=sleepstudy, group.variable="Subject")
inf1

d1<-cbpp
d1$period<-as.numeric(as.character(cbpp$period))
d1$response<-d1$incidence/d1$size
gm1 <- glmer(cbind(incidence, size - incidence) ~ 1 + (period | herd), data = d1, family = binomial)

inf1<-influenceFun(model=gm1, model.variable= "period", data=d1, group.variable="herd")
inf1

gm2 <- glmer(response ~ 1 + (period | herd), data = d1, weights=d1$size, family = binomial)
inf2<-influenceFun(model=gm2, model.variable= "period", data=d1, group.variable="herd")
inf2

p-schaefer/psUtilities documentation built on May 24, 2019, 5:56 p.m.