[R-sig-ME] Problem with profile and glmer

Ken Beath ken.beath at mq.edu.au
Mon Sep 15 06:21:37 CEST 2014


With the following code

library(lme4)
data(cbpp)

testprofile <- function(herd,incidence,size,period) {
  thedata <- data.frame(herd,incidence,size,period)
  gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
              data = thedata, family = binomial)
  pr4 <- profile(gm1)
}

testprofile(cbpp$incidence,cbpp$incidence,cbpp$size,cbpp$period)

I get the error in profile " Error: 'data' not found, but variables found
in environment of formula: try specifying 'formula' as a formula rather
than a string in the original model"

I have tried with as.formula for the formula. The profile and glmer work
fine when they are called outside the function.
-- 

*Ken Beath*
Lecturer
Statistics Department
MACQUARIE UNIVERSITY NSW 2109, Australia

Phone: +61 (0)2 9850 8516

Building E4A, room 526
http://stat.mq.edu.au/our_staff/staff_-_alphabetical/staff/beath,_ken/

CRICOS Provider No 00002J
This message is intended for the addressee named and may...{{dropped:9}}



More information about the R-sig-mixed-models mailing list