pbreheny/visreg

Wrong position of observations

Closed this issue · 2 comments

fit <- lm(Ozone ~ Solar.R + Wind + Temp, data=airquality)
visreg(fit, xvar="Solar.R")
points(x = airquality$Solar.R, y=airquality$Ozone, pch="+", col="red")

The grey points plot by visreg are not at the same place than red +
Based on my understanding of the package function, they should be...

R 4.1.3
visreg 2.7.0

Thanks

The points are correct. visreg is plotting the partial residuals, not the observed outcome (i.e., the ozone levels after adjusting for wind and temperature, in your example above). If you want to know the relationship between x and y without adjusting for other variables, that's just simple linear regression. The point of visreg is to illustrate the multivariate model.

Thanks for the precision. Marc