0
votes

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!

1
It's easier to help you if you include a simple reproducible example with sample input and desired output that can be used to test and verify possible solutions. Sounds like you don't have enough data to do the test.MrFlick
@MrFlick I've added the data.RmyjuloR
The only thing in that data.rda file is a length-1 vector containing the word "data". So I think the error may be a bit misleading but it is informative in the sense that it's telling you you don't really have any data. Voting to close as essentially a "typo".IRTFM
@42 That is probably just an issue with the link. I'm pretty sure I have data and the file that is linked is the correct file... I think I would be able to diagnose a data.frame is non existent when running a code like above :)RmyjuloR
Did you try downloading the file and then using load in an R session?IRTFM

1 Answers

1
votes

The issue is with NANs, remove all nans from your dataset and rerun the models. I had the same problem and that solved it.