Mediation Analysis Diary Study

Hi everyone,

I did a diary study.
It was 5 days, 2 times a day (morning and afternoon).

Morning measures I have:

  1. sleeping problems

Afternoon measures I have:

  1. Emotions
  2. Incivility

I want to test a mediation. First I want to teste the model with just the IV. But, when I do this on R:

summary(m1 <- lmer(sleepingproblems ~ incivility + (1 + incivility |code), data = data_within_measures))

I get the error:
Error in h(simpleError(msg, call)) : **
** error in evaluating the argument 'object' in selecting a method for function 'summary': missing value where TRUE/FALSE needed

I get the error. The reason is that because in the morning I only have measures for SP and in the afternoon I only have data for incivility, so they don´t match. But I don´t know how to solve it.
I would like to know if there is a way I can match both (e.g. matching the data from day 1 morning with the afternoon data, and so on). The idea is to see whether who experiences incivility will most likely experience sleeping problems as well.

I appreciate the help!
Thank you!!

Hi,

In order for us to help you with your question, please provide us a minimal reproducible example where you provide a minimal (dummy) dataset and code that can recreate the issue. Once we have that, we can go from there. For help on creating a Reprex, see this guide:

Good luck!
PJ

I hope it is like this so:

head(base_within_merged,6)[,c("code","register","sleepingproblems","expf2fwi","emotionalreactivity")]

code register sleepingproblems expf2fwi emotionalreactivity

1 aaja28 7 1.8 NA NA
2 aaja28 8 NA 1 1.000000
3 aaja28 5 2.0 NA NA
4 aaja28 6 NA 1 2.666667
5 aaja28 10 NA NA NA
6 aaja28 3 2.6 NA NA

library (nlme)
library (lme4)

m1 <- lmer(sleepingproblems ~ expf2fwi + (1|code), data = base_within_merged)

Error in lme4::lFormula(formula = sleepingproblems ~ expf2fwi + (1 | code), :
0 (non-NA) cases

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.