I have the following script in R 4.3.1, this isnt the complete script but just the relevant parts:
library(lme4)
library(lmerTest)
library(ggplot2)
library(lattice)
library(RColorBrewer)
MEDE.fin <- lmer(Relative_Value ~ Dilution + (Dilution|Paper) + (1|Paper:DataSet), data=DE_data)
dotplot(ranef(MEDE.fin), condVar = TRUE)
This gives me the following 2 graphs: Not the important graph Important graph
the second graph shows both the random effect on the intercept and slope, however i only want to use the part showing the slope. How do i solve this? (bonus points if you also can tell me how to change the colour of the graph layout)
I tried running this code (dotplot(ranef(MEDE.fin, condVar=TRUE))$Paper)$g[1]
which is a variation on what i found here on stackoverflow but it doesnt work.
Can't test because I don't have your data, but something like this should work:
dd <- as.data.frame(ranef(MEDE.fin), condVar = TRUE))
dd <- subset(dd, term == "Dilution")
library(ggplot2)
ggplot(dd, aes(y=grp,x=condval)) +
geom_point() + facet_wrap(~term,scales="free_x") +
geom_errorbarh(aes(xmin=condval -2*condsd,
xmax=condval +2*condsd), height=0)
Not sure what you meant by "change the color of the graph layout.