[R-sig-ME] Modelling with uncertain (but not missing) categorical random effect values

Michael Lawson mrm|500 @end|ng |rom york@@c@uk
Wed Jul 14 11:17:29 CEST 2021


Dear Thierry,

Many thanks for your email - that looks like what I am after. I have
never used INLA before, so thus far I have just made a basic model
without specifying any further arguments to the call. Am I on the
right lines? How would I go about extracting the predicted probability
of conspecific mating for each group within mum_sp?

values <- as.factor(unique(c(levels(dat$dad_1), levels(dat$dad_2),
levels(dat$dad_3), levels(dat$dad_4))))

formula <- con ~ mum_sp + f(mum_id, model = "iid") + f(dad_1, w_1,
values = values, model = "iid") + f(dad_2, w_2, values = values, copy
= "dad_1") + f(dad_3, w_3, values = values, copy = "dad_1") + f(dad_4,
w_4, values = values, copy = "dad_1")

model <- inla(formula, family="binomial", data=dat,
control.family=list(link='logit'))
summary(model)

Call:
   "inla(formula = formula, family = \"binomial\", data = dat,
control.family = list(link = \"logit\"))"
Time used:
    Pre = 0.462, Running = 3.3, Post = 0.115, Total = 3.88
Fixed effects:
               mean     sd 0.025quant 0.5quant 0.975quant   mode   kld
(Intercept)  12.696 10.298      0.834   10.000     40.536  6.699 0.087
mum_spL      18.725 11.824      3.426   16.051     49.365 11.804 0.023
mum_spN     -11.697 10.257    -38.926   -9.318      1.392 -6.208 0.031

Random effects:
  Name   Model
    mum_id IID model
   dad_1 IID model
   dad_2 Copy
   dad_3 Copy
   dad_4 Copy

Model hyperparameters:
                         mean       sd 0.025quant 0.5quant 0.975quant     mode
Precision for mum_id 2.03e+04 1.97e+04    977.697 1.43e+04   7.21e+04 2331.739
Precision for dad_1  9.20e-02 5.10e-02      0.025 8.20e-02   2.17e-01    0.061

Expected number of effective parameters(stdev): 25.62(0.441)
Number of equivalent replicates : 7.46

Marginal log-Likelihood:  -81.32

Many thanks,
Mike



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