Re: [R] back tick names with predict function

2023-12-03 Thread Robert Baer
On 12/1/2023 11:47 AM, peter dalgaard wrote: Also, and possibly more constructively, when you get an error like CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 'c') # fail Error in eval(predvars, data, env) : object 'plant-density' not found you should check your assump

Re: [R] Try reproduce glmm by hand

2023-12-03 Thread Viechtbauer, Wolfgang (NP)
Dear Marc, Plugging the BLUPs into the likelihood isn't going to give you the ll of the model. You need to integrate over the random effect. intfun <- function(nu, xi, mi, pred, theta) dbinom(xi, xi+mi, plogis(nu)) * dnorm(nu, pred, theta) lli <- rep(NA, nrow(df)) for (i in 1:nrow(df)) {