Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Permutation test error for likelihood ratio test of mixed model in R: permlmer, lmer, lme4, predictmeans

$
0
0

I would like to test the main effect of a categorical variable using a permutation test on a likelihood ratio test. I have a continuous outcome and a dichotomous grouping predictor and a categorical time predictor (Day, 5 levels).

Data is temporarily available in rda format via this Drive link.

library(lme4)
lmer1 <- lmer(outcome ~ Group*Day + (1 | ID), data = data, REML = F, na.action=na.exclude)
lmer2 <- lmer(outcome ~ Group + (1 | ID), data = data, REML = F, na.action=na.exclude)

library(predictmeans)
permlmer(lmer2,lmer1)

However, this code gives me the following error:

Error in density.default(c(lrtest1, lrtest), kernel = "epanechnikov") : need at least 2 points to select a bandwidth automatically

The following code does work, but does not exactly give me the outcome of a permutated LR-test I believe:

library(nlme)
lme1 <- lme(outcome ~ Genotype*Day,
                  random = ~1 | ID,
                  data = data,
                  na.action = na.exclude)

library(pgirmess)
PermTest(lme1)

Can anyone point out why I get the "epanechnikov" error when using the permlmer function?

Thank you!


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>