# [R] Conditional (paired) design for binomial regression in MCMCglmm

Rémi Lesmerises remilesmerises at yahoo.ca
Thu Feb 4 17:50:04 CET 2016

```| This is my first attempt asking question in this forum and I do it because thorough research on the web didn't give me any answer.I am trying to accomodate a conditional regression in a Bayesian generalized linear mixed model using Monte Carlo Markov Chain. I am using the package {MCMCglmm} in R. I already did such analysis with the {coxme} package and it worked well, but as I want to access random slope, it seems that I must use such approach to decrease the bias of estimates (Hadfield 2010). I (partly) understand how to code for binomial regression (link logit) in MCMCglmm but I cannot find any indication for paired design. Here an example of my dataset.data(bear)

Id  Strata   Site Real_rand  Spruce  Fir    Road
Sally  Sal-7  Sal-7         1      0    2     7.02
Sally  Sal-7 Sal-7A         0     40    0    94.40
Sally  Sal-7 Sal-7B         0      2    3    16.58
Sally  Sal-8  Sal-8         1      2   21    48.74
Sally  Sal-8 Sal-8A         0      8   17   112.75
Sally  Sal-8 Sal-8B         0     63    0   205.04It is a black bear habitat selection analysis, with used sites (variable Real_rand coded 1) compared with available sites (coded 0). It is a paired design because available sites were randomly drawn within a buffer zone around used site. I wonder if strata, nested in Id, could used as random factor and provide similar result than cox regression. Here an example of what it could looks like:prior <- list(R = list(V = 1, nu = 0.002), G = list(G1 = list(V = 1, nu=0.002),
(G2 = list(V = 1, nu=0.002)))

mod1 <- MCMCglmm(Real_rand ~ Spruce + Fir + Road, random = ~Strata:Id + us(Road):Id,
family = "categorical", data = bear, prior = prior, verbose = FALSE, pr = TRUE)I added a random slope (us(Road):Id) to have individual coefficient for road selection. There is probably many errors, both in the prior formula and the glm call, but if anyone can help me to find a way to code it more correctly, I would be grateful! |

Rémi L.
[[alternative HTML version deleted]]

```