let's say I wish to fit a regression model to disp ~ drat
from the mtcars
dataset. Is there a package I can use that can tell me what type of regression I should use e.g. linear, polynomial, bayesian etc.?
ggplot(mtcars, aes(disp, drat)) +
geom_point() +
facet_wrap(~cyl)
Pointing out the suggestion from @Roland you should do some exploratory and visual analysis to understand your data first. You can try with stat_smooth()
and then decide what kind of model you want to fit:
library(ggplot2)
#Code
ggplot(mtcars, aes(disp, drat)) +
geom_point() +
facet_wrap(~cyl)+
stat_smooth(se=F)+
stat_smooth(color='magenta',method = 'lm',se=F)
Output: