I am looking to plot the significant results of a GLMM output. One of the significant predictor variables (noise) is categorical and binary (can take 2 values - or names might be more accurate). The other two are continuous (self-report scales). However, I'm not sure what exactly this should look like - especially the categorical one as maybe a line graph isn't appropriate? - so I guess this is also a statistics question. Anyhow, I wrote code to create a line graph that plots noise against the estimated means but I'm not sure this is right nor how to interpret it other than using the gradient of the slope.
## Plot line graph for background noise main effect # Obtain estimated marginal means em_means <-emmeans(model, specs = "noise") # Extract predicted values predicted_values <- predict(em_means) # Step 4: Create a Data Frame for Plotting plot_data <- data.frame(noise = unique(d_multiple_regression$noise), y = predicted_values) # Step 5: Plot the Line Graph ggplot(plot_data, aes(x = noise, y = y)) + geom_line() + labs(x = "Background noise", y = "Estimated Means") + theme_minimal()
The code below outputs a similar graph but with the predicted probabilities of the response variable and a grey sloping overlay area around the line:
plot(ggpredict(model, terms = "noise"))