I am trying to understand which would be the most reasonable fitting form my data. Despite there are more appropriate appproach to test such relationship, the aproach I was suggested was to use the mixed model.
Here it is the data that I should fit
dput(head(d, 50))
structure(list(A = c(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6,
6, 6, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19,
19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 24, 28, 38, 38, 38, 43,
43, 43, 44, 44), B = c("1", "1", "1", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "1", "1", "1", "1", "1",
"1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "1", "1",
"0", "0", "0", "1", "1", "1", "1", "0", "0", "0", "0", "0", "0",
"0", "0", "0"), C = c(84.5, 84.5, 84.5, 72, 72, 72, 62, 62, 62,
88, 88, 88, 73, 96, 96, 96, 71, 71, 71, 112, 112, 112, 58, 58,
58, 135.5, 135.5, 135.5, 61, 61, 61, 73, 73, 73, 98.5, 98.5,
98.5, 145, 145, 145, 57, 57.5, 57.5, 57.5, 57.5, 117.5, 117.5,
117.5, 63.5, 63.5), D = c("first", "second", "third", "first",
"second", "third", "first", "second", "third", "first", "second",
"third", "first", "first", "second", "third", "first", "second",
"third", "first", "second", "third", "first", "second", "third",
"first", "second", "third", "first", "second", "third", "first",
"second", "third", "first", "second", "third", "first", "second",
"third", "third", "third", "first", "second", "third", "first",
"second", "third", "first", "second"), E = c(53.5486131719382,
52.0658832701111, 51.1252703023116, 62.1777969600058, 68.1653724448048,
55.1729911875874, 51.9208379138623, 77.7114105505713, 51.1320936704931,
53.2984048049127, 54.4032755860799, 54.5345061904833, 80.4283499174123,
52.2450907798009, 119.762572667194, 50.4877114728201, 56.6779005725869,
123.902281465904, 52.1607969492947, 62.3059580835547, 61.8818596031608,
54.8717471595071, 50.2339031438382, 51.8942686270856, 50.1327199601924,
50.0935048039274, 56.6676575632546, 50.1717362028103, 54.44573529547,
85.824036313583, 51.1385056614022, 53.9489394873141, 109.146107644087,
50.8510098446203, 50.0610283132002, 64.2033246655699, 50.0312026774164,
60.0373650159403, 185.420447101832, 58.0954571719926, 51.6650553490147,
53.2043545761918, 55.7686094666145, 92.662263587, 51.4929554350437,
50.7408257088424, 71.6407473899555, 50.0970812615913, 52.2945648476526,
62.1117988670448)), row.names = c(NA, -50L), class = c("tbl_df",
"tbl", "data.frame"))
Where it contains A, intended as ID, B as Gender, C a score questionnaire and D and E, that are respectively brain region where a brain signal was recorded and E the signal itself. I would be interested in testing relationship between E (dependent variable) taking into account B and C. Iwas just wondering as to which among this can be the correct model to fit.
#split
d %>% split(., .$D) %>%
map(function(x) summary(nlme::lme(E ~ C*B , random = ~1|A, x)))
#use A as random effect
summary(lmerTest::lmer(E ~ C*B + (1|A), d))
#use D as random effect
summary(lmerTest::lmer(E ~ C*B + (1|D), d))
#use both A and D as random effects
summary(lmerTest::lmer(E ~C*B + (A|D), d) %>% summary())
Unfortunately I am not that able to get the difference between them and in case they are all plausible I would like to know wether I can assess their godness of fit at the best (if you recommend some specific method for this case).
Thanks
fev
data medical statisticians would expect skewness from experience with such data and others would expect it on general grounds. I'll speak for those practitioners (from threads here, quite numerous, but I wouldn't want to say "most") who would never bother with any formal test but would carefully look at a normal quantile plot and consider working with say log or cube root transformation and/or using such a link in a generalised linear model. $\endgroup$