[R-sig-ME] MCMCglmm with zibinomial

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Jun 21 15:58:51 CEST 2011


Dear all,

I am trying to fit a zibinomial model with MCMCglmm. Everything works fine when I do the non-inflated model. But the zi models throws an error. Any suggestions on what when wrong?

Best regards,

Thierry

library(MCMCglmm)

nYear <- 20
nSite <- 50
nVisit <- 5
Start <- qlogis(0.7)
TrendOC <- -0.1
Detect <- 0.6
sdSite <- 1
Design <- expand.grid(Year= seq_len(nYear), Site = seq_len(nSite), Visit = seq_len(nVisit))
RFSiteOC <- rnorm(nSite, sd = sdSite)
Design$Occupancy <- plogis(with(Design, Start + (Year - 1) * TrendOC + RFSiteOC[Site]))
Design$Detect <- Detect
Design$Site <- factor(Design$Site)

set.seed(123456)
Design$Present <- rbinom(nrow(Design), size = 1, prob = Design$Occupancy) * rbinom(nrow(Design), size = 1, prob = Design$Detect) == 1

#this works fine
prior <- list(R = list(V = 1, fix = 1), G = list(G1 = list(V = 1, nu = 0.002)))
m <- MCMCglmm(Present ~ Year, random = ~Site, rcov = ~units, data = Design, family = "categorical", prior = prior)
plot(m)

#this throws an error
priorzi <- list(R = list(V = diag(2), fix = 2), G = list(G1 = list(V = 1, nu = 0.002)))
mzi <- MCMCglmm(Present ~ Year, random = ~Site, rcov = ~idh(trait):units, data = Design, family = "zibinomial", prior = priorzi)
#the error
Error in rowSums(data[, match(response.names[0:1 + nt], names(data))]) : 
  error in evaluating the argument 'x' in selecting a method for function 'rowSums': Error in `[.data.frame`(data, , match(response.names[0:1 + nt], names(data))) : 
  undefined columns selected




> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Dutch_Belgium.1252  LC_CTYPE=Dutch_Belgium.1252   
[3] LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C                  
[5] LC_TIME=Dutch_Belgium.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] MCMCglmm_2.12      corpcor_1.5.7      ape_2.7-2          coda_0.14-4       
[5] Matrix_0.9996875-0 lattice_0.19-28    tensorA_0.36       rj_0.5.5-4        

loaded via a namespace (and not attached):
[1] gee_4.13-16  grid_2.13.0  nlme_3.1-101 tools_2.13.0
----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey




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