[R-sig-ME] Levels in random effect

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Wed Nov 25 19:19:18 CET 2020


Dear Carlos,

In theory, you should be fine. The example below compares a paired t-test
and its mixed model equivalent. It has less levels and less replicates than
your example. Note that the estimates and t-values are identical.
In practice, you should carefully check your model. As you always should.

library(lme4)

set.seed(20201125)
n <- 50
sd_rf <- 2
sd_error <- 0.1
delta <- 0.2
rf <- rnorm(n, sd = sd_rf)
error <- rnorm(2 * n, sd = sd_error)
ds <- expand.grid(
  id = seq_len(n),
  type = 0:1
)
ds$y <- delta * ds$type + rf[ds$id] + error

t.test(ds$y[ds$type == 1], ds$y[ds$type == 0], paired = TRUE)
summary(lmer(y ~ type + (1|id), data = ds))

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
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
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>


Op wo 25 nov. 2020 om 18:07 schreef Carlos Barboza <
carlosambarboza using gmail.com>:

> Dear Dr. Bolker,
> I'm running a mixed model with 193 records including three continuous
> variables and an interaction. My random intercept has 75 levels.
> However, many of them with 2-3 replicates. Using lme and lmer
> everything runs ok with no problems of convergence, warnings etc. As I
> suspected I have a big contribution of random effects to the total
> variance. My doubt is if can I trust in model having levels of random
> effects with reduced number of replicates?
> thank you very much in advance
> Carlos
>
>
> --
> Universidade Federal do Rio de Janeiro (UFRJ)
> Instituto de Biodiversidade e Sustentabilidade - NUPEM
> Caixa Postal 119331, CEP 27910-970
> Macaé, RJ, Brazil
> https://www.macae.ufrj.br/nupem/
> http://lattes.cnpq.br/3629226944950076
> https://scholar.google.com.br/citations?user=p-PRvd4AAAAJ&hl=pt-BR
> https://www.researchgate.net/profile/Carlos_Barboza3
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



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