Skip to content

MCMCglmm:interaction bt continuous variable and categorical random effect

5 messages · john benson, Joshua Wiley

#
Hi John,

That is the basic idea, but I doubt you want to parameterize it quite
that way.  I would suggest:

Model1 <- MCMCglmm(used ~ slope + elevation + road,
  random = ~ us(1 + road):wolf + pack, family = "categorical",
  data = datum, prior = prior1, pr = TRUE)

which would fit a random intercept and slope by wolf, that are allowed
to be correlated, as well as a random intercept by pack (assumed
orthogonal to the others).

Having road in the fixed effects portion will give you the overall
effect, and then the random effects bit will be shrunken deviations
from that.

Cheers,

Joshua
On Sun, Mar 31, 2013 at 1:32 PM, john benson <smilodon2000 at hotmail.com> wrote:

  
    
#
Hi John,

I am not quite sure what road is --- if it is continuous, then:

us(1 + road):wolf

will yield a 2 x 2 variance covariance matrix, so, you would need
something like:

G = list(
  G1 = list(V = diag(2), nu = 1.002),
  G2 = list(V = 1, nu = .002)
)

(set your own nu values).  diag(2) just gives an identity matrix, so
basically the prior has the intercept/slope uncorrelated, although in
the posterior they may be.  Specifying a sensible prior is a bit
outside the scope of this list serv, I think.

If road is categorical, it may be worth thinking more about.  If it
only has a few levels, probably not a big deal.  If you have, say, 20
different roads, interacting that with 70 wolves, may be more complex
than your dataset will reasonably support.

Cheers,

Joshua
On Sun, Mar 31, 2013 at 2:20 PM, john benson <smilodon2000 at hotmail.com> wrote: