Effect Plot - get data points into Effect Plot - R

To all: I am trying to understand if there is a way to develop my effect plots further. I was wondering if there is a way to get the data points used to create the effect plots onto the effect plot itself, so it sort of looks like a scatter diagram.

I am using the packages: (ggplot2), (stargazer), (effects), (gridExtra), (plyr)

Code Used:
setwd("F:/Sussex PhD/data/constresult19")
my_gen <- read.csv("genhis.csv") #data set name
#linear models
const.qualsvc <- lm(Conpv1019 ~ + Noqual19 + Alevel19 + Degplus19 + Const5ac + Gdschlsrate + FSMKS2 + FSMAlevel, data = my_gen)
const.qualsvl <- lm(Conpv1019 ~ + Noqual19 + Alevel19 + Degplus19 + Const5ac + Gdschlsrate + FSMKS2 + FSMAlevel data = my_gen)
stargazer(const.qualsvc, const.qualsvl, type = "text")
#effect plots
eddeg.cona <- effect(term = "Degplus19", mod = const.qualsvc)
eddeg.cona <- plot(eddeg.cona, ylim=c(-20,30), xlab = "Percent Degree Qualification Plus", ylab = "Percentage Change in Con vote 2010-19", main="Effect of Degrees on Change in Con % Vote", col.line = "blue")
eddeg.laba <- effect(term = "Degplus19", mod = const.qualsvl)
eddeg.laba <- plot(eddeg.laba, ylim=c(-20,35), xlab = "Percent Degree Qualification Plus", ylab = "Percentage Change in Lab vote 2010-19", main="Effect of Degrees on Change in Lab % Vote",col.line = "red")

grid.arrange(eddeg.cona, eddeg.laba, ncol=2) #effect plots side by side

Kind Regards, James Prentice (Only a fairly basic level user of R)

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